You are here:
Integration Procedure Invocation from Apex (Managed Package)
For the managed package runtime, you can invoke an Integration Procedure from Apex code in two ways using the IntegrationProcedureService class in the Vlocity managed package.
This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.
Integration Procedure Call Example 1
class IntegrationProcedureService {
/*
procedureAPIName - the Type_SubType of Procedure or the OmniScript__c.Id
input - The payload / initial data in the DataJSON for the Procedure
*/
public static Object runIntegrationService(String procedureAPIName, Map<String, Object> input, Map<String, Object> options);
/*
VlocityOpenInterface2 implementation:
methodName - the Type_SubType of Procedure or the OmniScript__c.Id - procedureAPIName above
input - The payload / initial data in the DataJSON for the Procedure
output - will return Response in output.put('result', RESPONSE)
*/
public Object invokeMethod(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options);
}
Integration Procedure Call Example 2
Substitute your namespace, which is vlocity_cmt or
vlocity_ins.
/* Initialize variables */
String procedureName = 'Type_SubType';
Map<String, Object> ipInput = new Map<String, Object> ();
Map<String, Object> ipOutput = new Map<String, Object> ();
Map<String, Object> ipOptions = new Map<String, Object> ();
/* Populating input map for an Integration Procedure.
Follow whatever structure your VIP expects */
String orderId = '80100000000abcd';
ipInput.put('orderId', orderId);
/* Call the IP via runIntegrationService,
and save the output to ipOutput */
ipOutput = (Map<String, Object>) namespace.IntegrationProcedureService.runIntegrationService(procedureName, ipInput, ipOptions);
System.debug('IP Output: ' + ipOutput);

