Newer Version Available

This content describes an older version of this product. View Latest

Implementing Workflow Steps

Workflow Steps are implemented as APEX classes that are used in implementing the System.Callable interface.
1global with sharing class <your class name> implements System.Callable {
2    global Object call(String method, Map<String, Object> context) {
3        ...
4    }
5}
In the Workflow Step record, you need to define 2 attributes that maps to the APEX class:
  • Classname: The name of the APEX class that will be instantiated.
  • Method: The string value that will be sent to the APEX class call method as first parameter.
  • Entity: Defines the entity that will be passed to the APEX class.
On the context parameter, the passed in Object contains the following properties:
1// Common to all steps.
2String txId: TransactionId of the process
3String salesOrg: Sales organization passed to the execution.
4Object input: Whole Input Object
5Object output: Whole Output Object
6 
7// Step specific
8SObject workflowStepRecord: Workflow Step Record.
9 
10// Entity specific
11String inputPath: Path of the current input in the main input object.
12String inputEntityPath: A list of the names of the parent input entities ordered based on the deepness level. (i.e. Promotion/Tactic/TacticBrand).
13Object currentInput: Current block of the input object being processed.
14List<Object> parentInputs: A list of the parent Input Entities for this step. Each entry on the list will be the input Entity. Has the same number of elements as the inputEntityPath. (i.e. [ 0 ] → Promotion, [ 1 ] → Tactic, [ 2 ] → TacticBrand)
15 
16String outputPath: Path of the current output in the main output object.
17String outputEntityPath: A list of the names of the parent output entities ordered based on the deepness level. (i.e. BOPromotion/LOTactic).
18Object currentOutput:  Output object where the rule is expected to set the attributes. Rules are expected to set this object into the proper place of the parent.
19List<Object> parentOutputs: A list of the parent Output Entities for this step. Each entry on the list will be the output Object for the Entity. Has the same number of elements as the outputEntityPath. (i.e. [ 0 ] → BOPromotion, [ 1 ] → LOTactic)
During runtime, each Workflow Step is executed once for each available entity.