Call Apex Conditions

  • Select Call Apex condition type.
  • Select the Class Name in the picklist. To find class in the picklist easier, use Filter option.
  • Enter Parameters in a JSON format.

NOTE: Your custom Apex Class should implement WR_BPM.WorkflowCallApexRuleInterface Interface.

If Run method returns 'true' conditions will not be met and action won't be executed.

If you configure validation rule or action of 'Rule' type, an error message will be displayed. In case of action is a part of Global Actions Group, further actions won't be executed.

With the above setup global action will be executed (or will display error message if action type is 'Rule')  if {$Variables.callType} = 'check A' AND {$Variables.A} is not blank or if {$Variables.callType} = 'check B' AND {$Variables.B} = 'BBB'. Otherwise action won't execute.

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.