Skip to content

SVC_Omnistudio

Class · Group: Omnistudio

apex
global virtual inherited sharing class SVC_Omnistudio implements Callable

Implements: Callable

SVC_Omnistudio is a factory class that implements the Callable interface and is designed to instantiate and execute operations on specific classes based on a provided class name. It is mainly used within the Omnistudio framework to dynamically manage actions on classes. This class supports passing and handling parameters for both input and output operations.

Example

apex
// Implement an OmniCallable action
public class MyOmniAction implements SVC_Omnistudio.OmniCallable
{
    public void call(SVC_Omnistudio.Parameters parameters)
    {
        String input = (String)parameters.getInputVariable('name');
        parameters.setOutputVariable('result', 'Hello ' + input);
    }
}

Methods

MethodDescription
global Object call(String className, Map<String, Object> parameterMap)This global method dynamically instantiates a class based on the provided className and executes a method within the instantiated class to perform the requested operation.

call

apex
global Object call(String className, Map<String, Object> parameterMap)

This global method dynamically instantiates a class based on the provided className and executes a method within the instantiated class to perform the requested operation. The method takes a parameterMap containing arguments necessary for the operation and manages the interaction through the Parameters DTO.

Parameters

ParameterTypeDescription
classNameStringThe name of the class to instantiate; this class must implement Callable.
parameterMapMapA map of arguments to be used by the specified class for executing its logic.

Returns Object — Returns true if the operation is successful.

Throws

ExceptionDescription
ExceptionThis method may throw an exception if the specified class cannot be instantiated or if an error occurs during method execution. The exception will be logged.

Example

apex
Object result = instance.call('SVC_Omnistudio', new Map<String, Object>{'key' => 'value'});

Inner Classes

ClassDescription
OmniCallableA global inner interface that allows the SVC_Omnistudio class to instantiate a class and perform an operation within the Omnistudio framework.
ParametersA Data Transfer Object (DTO) used to wrap the original parameters provided by Omnistudio, organizing them into distinct input, output, and option maps.