> For the complete documentation index, see [llms.txt](https://docs.work-relay.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.work-relay.com/automations/apex-code/wr_bpm.workflowcallapexruleinterface.md).

# 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.

{% code overflow="wrap" lineNumbers="true" %}

```apex
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;
    }
}
```

{% endcode %}
