1

This documentation shows that you need to use the referenceID with each record to do batch creation.

Does Salesforce use this referenceID to achieve (per-record) idempotency?

Or will it just create a whole new record if I make multiple calls?

2

I think what you are asking is whether the Reference Id becomes a persistent Id, such that calling the Composite REST API multiple times and providing the same Reference Id is idempotent.

The answer to that is no. The Reference Id has validity only within the scope of one call (with however many subrequests) to the Composite API. Your application must consume the returned result to correlate the Reference Ids you supplied with either Salesforce Ids, which are persistent and which you may reference in future update/upsert requests, or with errors.

If you include multiple subrequests within the same call to Composite, you may use Reference Ids to tie those subrequests together, such as a request to create an Account and subsequently create a Contact under it.

| improve this answer | |
  • Thank you so much! That's a shame -- it would be have been great if it could be used for idempotency. – Salesforce user Sep 14 at 4:17
  • @Salesforce user Any external id field on the record will do what you're after. – identigral Sep 14 at 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.