On Salesforce, we have our Opportunity sObject contains a lookup to a custom SObject BankDetails__c.

We would like to create an integration from the Microsoft Azure platform which would update both the Opportunity and BankDetails in a single call.

I'm trying to decide the best approach for this. I'm inclined to either use the REST Api or Apex Rest services.

As we'd want the update to be handled as a transaction, making two calls to the REST Api does not seem viable.

Would it be possible to push both records at once with a single call to the REST Api? If so, how?

If not, is there any reason to prefer some other solution over Apex REST Services?

1 Answer 1


You can try to make a request to this endpoint with a body like this:

    "allOrNone" : true,
    "compositeRequest" : [{
        "method" : "PATCH",
        "url" : "/services/data/v48.0/sobjects/Opportunity/*whateverId*",
        "referenceId" : "UpdatedOpp",
        "body" : {  
            "Name" : "Salesforce"
        "method" : "PATCH",
        "referenceId" : "BankDetails",
        "url" : "/services/data/v48.0/sobjects/BankDetails__c/",
        "body" : {  
            "Name" : "John Doe"

To do it, you can add this content to a file, lets say "composite.json", and execute the following command: curl https://yourInstance.salesforce.com/services/data/v38.0/composite/ -H "Authorization: Bearer token -H "Content-Type: application/json" -d "@composite.json"

This may be helpful for you: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_composite_sobject_tree_create.htm`

Take a look at this one too: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_composite_junction_object.htm

  • Composite resource appear to be exactly what we are looking for. Unless someone suggests something better before I implement and test this assuming it works, I'll be accepting this later. Cheers! Jul 2, 2020 at 11:17
  • 1
    My pleasure, I am glad to help, hope you find it really useful :) Jul 2, 2020 at 12:01
  • 2
    Per our network guidelines, you should include the core details of the answer here rather than just providing a link. You'll get more votes this way, and people will be less inclined to vote to have your answer deleted.
    – sfdcfox
    Jul 2, 2020 at 13:04
  • Thank you for the tip, I will edit the answer and keep that in mind. I know it is not an excuse but I and pretty new over here. Jul 3, 2020 at 6:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .