Learn how to use Apex Remote from FlexCard and OmniScripts and what is required for the Apex class.
Sample code for the Apex Remote class can be found on github here.
To use Apex Remote, you need to define the class then you can select this as a Data Source type when creating a FlexCard or OmniScript.
Creating an Apex Remote Class For OmniStudio
First create an Apex Class that implements the VlocityOpenInterface.
Add the default implementation method invoke
- methodName – name of the method to be called
- inputMap – key/value map passed to the class
- outMap – key/value map to return as part of the response
- options – key/value map
Create a try/catch that calls the method and returns the Boolean value
Next, create your method and set the outMap.
Using The Apex Remote From FlexCard
Create a new FlexCard from OmniStudio FlexCard Designer
- From the Data Wizard or the Setup Panel select Apex Remote as Data Source Type
- Provide a Remote Class – AccountRemoteClass
- Provide a Remote Method – getAccountRecords
- Optionally provide Is Async and Poll Interval
- Add InputMap or OptionsMap
- Result JSON Path – set to [“account”]
Add a Text Field to the Canvas and populate with the field results
Run the Preview and it should display the data.
Hope you like this post. I’ll be coming up with a newsletter soon to deliver the fresh tips and tricks.