You can configure a Callout Task capable of synchronously calling an Integration Procedure, but asynchronously awaiting one or more responses from a third party application.
- Create a System SObject:
- From the + tab, click Systems.
- Click New.
- Enter a dummy URL as it will be ignored by the implementation because you are calling an Integration Procedure instead of making a call to a REST endpoint.
- Save your work. The page for your new system appears.
- In your new system, click New System Interface.
- System
- Create a system interface SObject
- Path
- Use the Integration Procedure key, which is typically, <type>_<subtype>.
- Implementation
- Specify the class shown above without the .cls extension.
- Create a new Callout Task for an Orchestration Plan:
- From the + tab, click Orchestration Plan Definitions.
- Select a plan.
- Click New Orchestration Item Definition.
- From Record Type of new records, select Callout.
- Set the System Interface to the one you just created.
- Save your work.
- Verify the Integration Procedure you are attempting to call has been activated and proceed to create a test order with appropriate products to trigger the Orchestration Plan Definition. Decompose the order and start the orchestration plan to see the results. In this case, the Orchestration Item should remain in an 'Active' state as shown in blue. Orchestration Item remains active until a successful callback is made.
- Make a callback manually with Postman or another tool. Determine the callback URL. Click the Orchestration Item and open it to capture the SObject ID of the Callout Task from the URL. Use that Id to run a SOQL Query, such as:
SELECT Name,Request__c FROM vlocity_cmt__OrchestrationItem__c WHERE Id = 'a2b1U0000001ZtLQAU'
The Request__c field contains the JSON payload that was sent to the third-party system and the callback URL, which is referred to as the responseUri, within the JSON string. It is usually in the format:
/services/apexrest/vlocity_cmt/asyncCallback/<orchestration_item_id>
After you make a successful callback, the Orchestration Item changes to a Completed state. It may take a few seconds for it to update.