Salesforce Composite Request-Camouflages and Alternatives

Ismeet Kaur
Another Integration Blog
4 min readJun 2, 2023

How do you go above and beyond? What makes you strive for success?

Overview

You must have read the ins and outs of how to use a Salesforce Composite Request from my previous blog. But did you dig deeper after and try to find the limitations of this connector and how you can overcome them? In this blog, I will mention all the misses of Composite Request and how we can make them the hit.

Camouflages of SF Composite Request

This may come in as a refresher or new information for you. I read the fine print of the documentation and am here to share it with the community.

  • 25 subrequests: You can only have up to 25 subrequests in a single call.
  • allorNone: You can regulate how your request acts when an error occurs based on the allorNone parameter. This can exist on the composite request level and one on each sObject Collections subrequest, and the Outcome will differ accordingly. Refer here for a great pictorial representation.
One of the possible use cases for the allorNone parameter.
  • collateSubrequests: You can control the API collates unrelated subrequests to bulkify them or now. If this field is set to true, then the processing speed is faster, but the order of execution is not guaranteed. Remember, collation can cause issues if there are implicit but not explicit dependencies between items. This feature is available in API version 48.0 and later. In API version 49.0 and later, the default value is true. In version 48.0, the default value is false. Refer here for more information.
Collate subrequests
  • sObject Collections: We discussed that a composite request can not have more than 25 subrequests. But out of those 25 subrequests, there can only be up to 5 sObject Collections or query operations, including Query and QueryAll requests. So if you plan on creating a composite request with more than 5 subrequests, then keep reading as we discuss it in the later segment.
sObject Collection Limit
  • ReferenceIds: The referenceIds must not contain anything besides letters, numbers, and underscores (‘_’). For version 51.0 and Earlier, the subrequest with illegal characters fails. But in API version 52.0 and later, any illegal characters in reference IDs cause the whole request to fail.
  • References to Null Fields: The API’s behaviour if there are references to null fields depends on the API version. The pertinent API version that is used to make the composite request. That version isn’t necessarily the same as the API version specified in the URL parameters in the subrequests. For version 51.0 and Earlier, the fact that the field is referenced to null causes the dependent subrequest to fail. But in API version 52.0 and later, the request succeeds.
References to Null Fields

Alternatives to SF Composite Request Limitations

Finding alternatives to the unseen pointers is significant to avoid any unknown. To do so, there are a few steps that you can take.

  • To execute more than 25 subrequests, you can look into composite graph requests, which allows you to execute up to 500 subrequests at a time. But this some with its due limitations and camouflages. Please refer here for more information.
Limitations of composite graph request
  • If you need to perform more than 5 queries, Break the composite request into two or more. Combine the results of each composite request using the reference ids as needed.
    If your composite request consists of more than 5 subrequests, the following requests will not be executed and you will not receive a response back.
  • Remember to collate your subrequests only if there are no explicit dependencies in the order of execution of each subrequest.

Conclusion

It is only fair that each feature has its own limits. Each limit is succeeded by the next new feature, which goes above and beyond. But that does not leave the previous feature less worthy. It only gives us developers more tools to use and makes our code robust and relevant. So the more we develop, the greater inspiration we get to create new innovations. These fine prints that we often overlook are the blueprints for their advancements.

Next Steps

Try as many features and components as you can so we can build together better code for the future.

--

--

Ismeet Kaur
Another Integration Blog

I want to inspire women to not be afraid and take on tech. I encourage all Women who Mule to stand stronger together.