You are here:
Invoke a Chainable Integration Procedure with REST Calls
A chainable Integration Procedure is split into multiple transactions to avoid hitting Salesforce governor limits. Using a REST API is the easiest way to see the partial responses each transaction returns before the Integration Procedure completes.
Before You Begin
-
Determine the namespace that Integration Procedures in your org use; for example,
omnistudio. -
Create this Integration Procedure example or import its DataPack: Create a Try-Catch Block Example with a Formula.
-
Get the session ID for your current login to your org. See Set Up Authorization in Salesforce's REST API Developer Guide.
Use the Integration Procedure with the REST API:
- Open the Integration Procedure example in your org. If you imported the DataPack, it's listed under Documentation/IPTryCatch2 or Documentation/IPTryCatchF2.
- In the Preview tab, try different Name input parameter values until you find one that returns more than one record but not many. An ideal Name value returns two names.
-
In the Procedure Configuration, click Deactivate Version if
the Integration Procedure is active so you can edit it. Set the Chainable
Query Rows Limit to a value low enough to cause chaining.
For example, if the Name value in the previous step returns two records, a Chainable Query Rows Limit value of 1 results in two transactions. If the Name value returns three records, a Chainable Query Rows Limit value of 2 results in three transactions.
- Go to the DRExtractAction1 component and check its Chain on Step property.
- Go back to the Procedure Configuration and click Activate Version.
-
In a terminal, enter a curl command of this form to call the REST API:
curl -X POST \ -H 'Authorization: Bearer session_id' \ -H 'Content-Type: application/json' \ -H 'chainable:true' \ --data-raw '{"Name":"Name"}' \ https://ap1.salesforce.com/services/apexrest/namespace/v1/integrationprocedure/Type_SubTypeFor example, if the Name is
Jones, the namespace isomnistudio, the Type isDocumentation, and the SubType isIPTryCatchF2, enter this curl command. The session ID, which is a long string of the form00Dnn000000nnnn!ARUAQLt...QqodNY3, is shown as SessionId for clarity.curl -X POST \ -H 'Authorization: Bearer SessionId' \ -H 'Content-Type: application/json' \ -H 'chainable:true' \ --data-raw '{"Name":"Jones"}' \ https://MyDomainName.my.salesforce.com/services/apexrest/omnistudio/v1/integrationprocedure/Documentation_IPTryCatchF2TipYou can assemble the curl command in a text editor and copy it into the terminal.
-
Examine the response, which contains the
vlcIPData:{ "vlcUseQueueableApexRemoting": false, "vlcMessage": null, "vlcIPData": "dc3e1986-2f7c-0871-e968-28eb63e11820", "vlcStatus": "InProgress" }NoteIntegration Procedure Preview handles chaining automatically, so you never see this type of response in the Preview.
-
Add a header for the
vlcIPDatato the curl command and enter it:curl -X POST \ -H 'Authorization: Bearer SessionId' \ -H 'Content-Type: application/json' \ -H 'chainable:true' \ -H 'vlcIPData:dc3e1986-2f7c-0871-e968-28eb63e11820' \ --data-raw '{"Name":"Jones"}' \ https://MyDomainName.my.salesforce.com/services/apexrest/omnistudio/v1/integrationprocedure/Documentation_IPTryCatchF2 -
Examine the response. If it contains another
vlcIPDatavalue, repeat the previous step with the newvlcIPDatavalue. Keep repeating with each newvlcIPDatavalue until the response contains no such value.This response is an example of what's returned when the Integration Procedure is complete.
{ "response": {}, "ResponseAction1Status": true, "Name": "Jones", "options": { "Accept": "*/*", "X-B3-SpanId": "ee09609f22d890e1", "CipherSuite": "ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 256-bits", "User-Agent": "curl/7.64.1", "X-B3-Sampled": "0", "Host": "MyDomainName.my.salesforce.com", "X-B3-TraceId": "ee09609f22d890e1", "chainable": "true", "X-Salesforce-SIP": "42.42.42.42", "Content-Type": "application/json" }, "DRExtractAction1Status": true, "DRExtractAction1": [ { "ContactName": "John Jones" }, { "ContactName": "June Jones" } ], "TryCatchBlock1Status": true, "TryCatchBlock1": null }

