WR_BPM.WorkflowCallApexRuleInterface
WorkflowCallApexRuleInterface interface is used to execute Work-Relay Process Rules and Global Actions with "Rule" action type that use Apex.
Below is example of Apex Class that performs Rule Validation.
If "run" method returns "true" process will not move forward (Process Rule) / further Global Actions won't be executed (Global Action Rule) and error configured in action will be displayed.
public with sharing class WR_ApexRulesExpample implements WR_BPM.WorkflowCallApexRuleInterface
{
public static Boolean run(sObject context, WR_BPM__Flow_Instance_Cursor__c flowInstanceCursor, String parameters)
{
Map<String, Object> params = (!String.isBlank(parameters) ? (Map<String, Object>)JSON.deserializeUntyped(parameters) : new Map <String, Object>());
if(params.get('callType') == 'check A')
{
if(String.isBlank((String)params.get('A')))
return true;
else
return false;
}
else if(params.get('callType') == 'check B' && params.get('B') == 'BBB')
return false;
return true;
}
}
0 Comments
Add your comment