Workflow Rule for Custom Module Auto Phone Validation

Workflow Rule for Custom Module Auto Phone Validation


Step 1: Go to Setup -> Automation -> Workflow Rules


Step 2: Click "Create Rule" and you will see the "Create New Rule" popup:


Set the "Module" to your custom module.

Give your rule a meaningful name, for example "ZE_CRM_Toolbox_On_Edit_{{CUSTOM_MODULE_NAME_HERE}}_Phone_Number"



Click "Next".

Step 3: On the next Popup:

Select to "Execute this workflow rule based on": "Record Action" -> then select "Edit" -> then select "Specific field(s) gets modified".

Tick "Repeat this workflow whenever a tenancy is edited"

A new input will popup with an input next to "When". In that input, select the Phone number field you want to act as the trigger, then for "is modified to", select "not empty":



Click "Next".

Step 4: Select "All {{Custom Module Name Here}}" and click "Done":



Step 5: Click Instant Actions -> Function:




Step 6: Click "Configure Action", then click "Write your own":


Step 7: Set the "Function Name" and "Display Name" to the same value as the Workflow Rule and click "Create": 



Step 8: Edit the code

The code editor should load with code that looks like this (but with your Function Name after "automation."):



Paste the below code in between the { } (curly braces) and change "Tenancies" to the API_Name of your Custom Module (you can find the Custom Module API Name under "Setup" -> "Developer Hub" -> "APIs and SDKs" (then click on the "API name" tab at the top, and scroll down to your custom module -> the api name is the value in the second column):
  1. //
  2. // CHANGE THIS BELOW VALUE TO THE API NAME OF YOUR CUSTOM MODULE: 
  3. Module_API_Name = "Tenancies";
  4. //
  5. // DO NOT EDIT THE CODE BELOW THIS LINE:
  6. Script_Name = "ZE_CRM_Toolbox_On_Edit_Lead_" + Module_API_Name + "_Number";
  7. //
  8. Return_Map = Map();
  9. Error_Map = Map();
  10. //
  11. try 
  12. {
  13. // USE STANDALONE FUNCTION TO VALIDATE RECORD PHONE NUMBERS
  14. response = zelogger.ZE_CRM_Toolbox_Execute_Action_On_All_Record_Fields(Module_API_Name,Record_ID,"validatePhone");
  15. //
  16. if(response == null || response.containKey("SUCCESS") == false)
  17. {
  18. Error_Map.put("Error running automatic Phone Number Validation",response);
  19. }
  20. else
  21. {
  22. Return_Map.put("SUCCESS","Phone Number Validation Automation Completed Successfully");
  23. }
  24. //
  25. }
  26. catch (e)
  27. {
  28. Error_Map.put("Catch Error",e);
  29. }
  30. //
  31. //
  32. if(Error_Map.isEmpty() == false)
  33. {
  34. Return_Map.put("ERRORS",Error_Map);
  35. //
  36. zelogger.Create_ZE_Log(Record_ID,Module_API_Name,"Error",Return_Map,"Low",Script_Name);
  37. }
  38. //
  39. info Return_Map;

Step 8: Add the "Record_ID" as the "Arguments" to the Workflow Rule:

Click on the ( x ) tab on the top right-hand corner, under ⓘ and set the "Record_ID" as the custom module Id (press "#" to open the "Add Merge Field" popup, then select the Module [usually first option] then select the field as the Record ID [usually the first option]:



Step 9: Click "Save and Associate" and then on the next screen click "Save" and you're done!






    • Related Articles

    • Workflow Rule for Custom Module Auto Email Validation

      Step 1: Go to Setup -> Automation -> Workflow Rules Step 2: Click "Create Rule" and you will see the "Create New Rule" popup: Set the "Module" to your custom module. Give your rule a meaningful name, for example ...
    • Custom Module and Custom Email and Phone Field Support

      ? To add support for Automatic Phone Number validation on Custom Modules, follow these instructions here: https://support.zepartner.net/portal/en/kb/articles/workflow-rule-for-custom-module-auto-phone-validation ✉️ To add support for Automatic Phone ...
    • 🔍 Understanding the Differences: Email & Phone Checks

      In our platform, we offer several different types of checks to help you keep your data accurate and actionable. Here’s a breakdown of the key differences between each service: ✅ Validate Email Addresses What it does: Checks whether the email address ...
    • Using ZE CRM Toolbox APIs in Custom Functions

      Coming Soon!
    • ZE CRM Toolbox Installation Support

      ZE CRM Toolbox Install ZE CRM Toolbox → ZE CRM Toolbox for Zoho CRM Extension helps automatically track successful and unsuccessful automations and scripts. This app automatically alerts you of any critical errors so that you can address them ASAP or ...