Salesforce Custom Object Query - REST - database

I was just wondering if there is a Salesforce url I could query to return only custom objects. I know that you can get all objects using this url:
/services/data/v26.0/sobjects/
However, I don't know the url to just get custom objects, if one exists at all. Any help is appreciated. Thank you.

Force.com Rest API works exactly equal for Custom or Standard objects.
Try this:
/services/data/v26.0/sobjects/MyCustomObjectName__c
MyCustomObjectName__c should be the API object name instead standard name.

Related

How to know people get promoted on Azure AD User Object

I need to get the information if a user in Azure AD get promoted. Information i got so far from this documentation: https://learn.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0
There is a JobTitle property, but i don't see property like: JobTitleHistory, or JobTitleChangeDate
Is there a workaround to get the promotion information?
Thanks!
There is no such field like JobTitleHistory, or JobTitleChangeDate.
There is a workaround you can get to know what changes are made to user profile using delta query.
I tested in my environment by changing the JobTittle=Null to JobTittle=Software Engineer :
Delta Query: The purpose of delta query is to retrieve all the
changes.
Use the below URL to generate the #odata.nextLink
URL: https://graph.microsoft.com/v1.0/users/delta/?$filter=id eq‘Object ID’
Use #odata.nextLink link to get the changes to for particular user. Use Key Value prefer:return=minimal in Request Header to get only the updated attribute.
Reference : https://learn.microsoft.com/en-us/graph/delta-query-overview

Use query string in URL or use multiple URL?

If I want to display many posts in my web application but every post have its own type and I want to display each type in single page so, What's the best method to do that? Is put all all posts in one url and use query string to filter the posts upon the type and display it in the page?
For example : axios.get('/posts?type =sport')
Or I have to put every single type in separate Url
For example: axios.get('/posts/sport')
Also one more question please?
use one reducer to manage every posts or create one reducer for each post type?
you can add a dynamic route to every new type.
Ex:
'/transaction' -> component-1
'/transaction/:type' -> component-any (multiple)
welcome to Stackoverflow!
I can imagine you have a web API of some sort serving a URL /posts. You want to consume that endpoint from your web application, and you are using axios to do that. I can assume you are using JSON to return that data. Correct me if I'm wrong.
Now that the basic information is "clear", what data you serve from the endpoint, and how it is requested from the client is up to you. Do you want to ask the server what types are there first, and then do one AJAX request per type? Ok. Do you want to serve all posts independent of their type? Ok. Do you want to accept POST data in your controller so you can filter the results before returning a response? Ok.
If you are looking for a more specific answer, you must give more details, or specify more. But I hope I could be of help.
Edit: complete answer.
If you want to filter the results, you have to send some additional data in your POST request, in this case, your post type. In axios, this could be done like this:
axios.post('https://example.com/posts', {
type: 'sports'
}).then((data) => {
console.log(data);
});
You can obviously get the "type" value from a select input, other variable, even the current router page. I don't know your exact setup, but you can always come back and ask ;)
THEN, in your API controller you have to get that POST parameter type, and use it to filter the results. Again, I don't know your exact setup, but for MySQL if would be a WHERE statement in your query, or similar.

Custom Activity Data Binding with Salesforce Objects

We can't extract data from the incoming Salesforce Object in the Journey Builder to the Custom Activity we made. We have already followed the syntax that was instructed in your documentation -> https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/how-data-binding-works.htm (under Event Context section).
We are primarily using Postmonger for our Custom Activity, and in our config.json under the inArguments, we input something like below to fetch the data from the Salesforce Object:
"fieldKey": "{{Event." + [ eventDefinitionKey ] + ".Task:Field_Name__c}}"
The eventDefinitionKey we get from the data loaded by triggering the requestedTriggerEventDefinition exposed by the Postmonger.
The resulting inArguments from above would be something like this:
"fieldKey": "{{Event.SalesforceObjacf28b016bf83c75b4926e0ec292eda5.Task:SMS_Content__c}}"
And based from the documentation mentioned previously, that syntax should be enough, yet we cannot retrieve it on our Custom Activity.
Another thing to note is that we can fetch information using the same syntax if the entry object is a Data Extension like below:
"fieldKey": "Event.DEAudience-e56d43c3-e2cf-60f1-fecd-ecf4d358d7b4.Field_Name"
The syntax above work which uses Data Extension is okay, but the one with the Salesforce Object does not.
What are we doing incorrectly here or is not possible entirely?
NOTE: the journey gets triggered by creating a task in Service Cloud
We put " around the eventDefinitionKey and the field name as well, and it works from Salesforce Data sources.
Something like:
"fieldKey": '{{Event."SalesforceObjacf28b016bf83c75b4926e0ec292eda5"."Task:SMS_Content__c"}}'
Note the switch to single quotes and how we're explicitly wrapping those inner attributes with double quotes
Update Oct 2020
Please see this post here which allows you to see the full merge fields of the entire Data Extension (no matter what type it is)

SuiteCommerce Advanced - Show a custom record on the PDP

I am looking to create a feature whereby a User can download any available documents related to the item from a tab on the PDP.
So far I have created a custom record called Documentation (customrecord_documentation) containing the following fields:
Related item : custrecord_documentation_related_item
Type : custrecord_documentation_type
Document : custrecord_documentation_document
Description : custrecord_documentation_description
Related Item ID : custrecord_documentation_related_item_id
The functionality works fine on the backend of NetSuite where I can assign documents to an Inventory item. The stumbling block is trying to fetch the data to the front end of the SCA webstore.
Any help on the above would be much appreciated.
I've come at this a number of ways.
One way is to create a Suitelet that returns JSON of the document names and urls. The urls can be the real Netsuite urls or they can be the urls of your suitelet where you set up the suitelet to return the doc when accessed with action=doc&id=_docid_ query params.
Add a target <div id="relatedDocs"></div> to the item_details.tpl
In your ItemDetailsView's init_Plugins add
$.getJSON('app/site/hosting/scriptlet.nl...?action=availabledoc').
then(function(data){
var asHtml = format(data); //however you like
$("#relatedDocs").html(asHtml);
});
You can also go the whole module route. If you created a third party module DocsView then you would add DocsView as a child view to ItemDetailsView.
That's a little more involved so try the option above first to see if it fits your needs. The nice thing is you can just about ignore Backbone with this approach. You can make this a little more portable by using a service.ss instead of the suitelet. You can create your own ssp app for the function so you don't have to deal with SCAs url structure.
It's been a while, but you should be able to access the JSON data from within the related Backbone View class. From there, within the return context, output the value you're wanting to the PDP. Hopefully you're extending the original class and not overwriting / altering the core code :P.
The model associated with the PDP should hold all the JSON data you're looking for. Model.get('...') sort of syntax.
I'd recommend against Suitelets for this, as that's extra execution time, and is a bit slower.
I'm sure you know, but you need to set the documents to be available as public as well.
Hope this helps, thanks.

Support for query parameters in Dart for Google Endpoints?

I have a Dart application that's getting data from a custom Google endpoint. I'm using discoveryapis_generator to generate the client library. I would like to issue a query like the following:
import endpoints_api.dart as EndpointsApi;
api = new EndpointsApi.MyApi();
api.photos.list(api.Photo.post_id == "post1");
endpoints_api.dart is the client library generated by discoveryapis_generator generate.dart. MyApi is my custom endpoints API, and photos is one of its services. I think Photo is an endpoints model class which has an instance property post_id.
Issuing the request results in an error to the effect that Photo has no static getter "post_id". This is close to how to the syntax of a query in the Python API, so it was the only way I could think of to specify it here.
I don't know what else might be helpful in describing my request. Hopefully it is self-evident. There's an active enhancement described here, but it seems to refer to limiting the fields, rather than items, in the response.
Update:
Poking around in the client library, I found the source for the list methods. It certainly looks like query parameters are supported. But it seems to me that it's not entirely correct. The formal parameter list contains the query parameters specified in the API surrounded by braces:
async.Future<PhotoCollection> list({core.String postId, core.String regionId}) {...
But in the method body, there's the following:
if (regionId != null) {
_queryParams["region_id"] = [regionId];
Are the brackets in [regionId] to extract region from the parameter list?
I pulled the braces out of the parameter list. Since I only ever expect to query by postId, that's the only parameter:
async.Future<PhotoCollection> list(core.String postId) {...
Voila. I can now add a parameter to the query by just specifying its value in the call:
api.photos.list("post1");
If you wrap the parameters of a method in curly braces, you make them optional.
So you can still use your method with the given signature. You just have to add the name of the parameter you want to pass:
api.photos.list(postId: "post1");

Resources