For the managed package runtime, you can add custom functions for use in formulas using Apex.
This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.
Note
In Vlocity Health and Insurance Spring '21 and later releases, you can use the FUNCTION function instead.
- Create the Apex Code for the Custom Function.
- Define the Metadata for the Custom Function.
-
Handle any
LISTinput. - Test the Custom Function.
- Create the Apex Code for the Custom Function (Managed Package)
For the managed package runtime, to implement a custom function, define an Apex class and add a method to the class that contains the function logic. - Sample Apex Code for a Custom Function in Omnistudio for Managed Packages (Managed Package)
For the managed package runtime, an Apex class implements methods for three custom functions in Omnistudio for Managed Packages. Integration Procedures and Omnistudio Data Mappers can use these functions to convert a list to an array, replace one character with another, or reformat phone numbers. The class andinvokeMethodof custom functions must be global. - Define the Metadata for the Custom Function (Managed Package)
For the managed package runtime, you must define the metadata required for a custom function in Salesforce. - List Input in Custom Functions (Managed Package)
For the managed package runtime, if an input to your custom function is of the typeList<Object>, the input is saved to aVLOCITY-FORMULA-LISTkey. To retrieve the input, use code that retrieves this key. - Test the Custom Function (Managed Package)
For the managed package runtime, to verify that you have configured the custom function correctly, go to the Omnistudio Data Mapper Designer Formula tab, add a formula, and type the first letter of the function name. The list of available functions is displayed, and if your configuration is correct, your function is listed.