You are here:
Call an Apex Class or an Invocable Action from an Integration Procedure
To call an Apex class and method, or an invocable action, use a Remote Action and pass in invocation options and data.
If the data that a remote action returns isn't in Map<String, Object> format, sometimes an Integration Procedure or
Omnistudio Data Mapper can’t process it. Because the returned data isn’t an sObject, you can't use it
to update Product2 objects without reserializing. You can convert the data in one of these
ways:
-
In the remote action, under Remote Options, add a Key named
reserializewith a Value oftrue. -
In a subsequent Set Values step, use the RESERIALIZE function on the remote action's output.
For information about related functions such as DESERIALIZE and SERIALIZE, see the Supported Data Mapper and Integration Procedure Functions. For information about reserializing map objects as inputs, see Create a Remote Action Apex Class Example.
An error message that begins with Invalid conversion from
runtime type String often indicates a need to reserialize data.
Make sure that you include the ID in the SOQL query. That field is required because the Apex class retains the queries and serializes data according to what’s executed.
If you receive an error that says the Apex class can’t be loaded, add the Apex class namespace in the Remote Class field in the remote action like this: {yournamespace}.ApexClassName. For example, omnistudio.PrefillOrders where omnistudio is the namespace and PrefillOrders is the Apex class.
To ensure that a Remote Action error causes a rollback if Rollback on
Error is checked in the Procedure Configuration, set the errorCode in the class output map.
- Create a Remote Action Example for an Invocable Action
This example Integration Procedure uses a Remote Action to call the emailSimple Invocable Action, which is present in every Salesforce org. Inputs to the Invocable Action are specified in the Integration Procedure as Additional Input. - Create a Remote Action Example for an Invocable Action with an Input Key
An Integration Procedure uses a Remote Action to call the emailSimple Invocable Action, which is present in every Salesforce org. Inputs to the Invocable Action are specified in the Integration Procedure in a Remote Option named InvocableInputKey. - Create a Remote Action Apex Class Example
This example Integration Procedure uses a Remote Action to call an Apex class and demonstrate how to reserialize data.

