Custom Actions

Custom Actions

Zoho Developer provides various options to automate repetitive tasks and implement customizations that meet your business needs. These automations and customizations, however, have some constraints in their ability to personalize results for the end user. Consider the example of a CRM for a garage where SMS notifications need to be sent to the customers on three different occasions: the first one welcoming them, the second one to inform them about the estimated cost of service after their vehicle has been inspected, and the final one informing them of their vehicle's service completion date. If a Custom Function is used in this scenario, then three different custom functions need to be written and associated with three different workflows. But if Custom Actions are used, then the same custom function can be used to trigger the SMS messages for all three cases, with the content of the messages decided by the CRM's end user.

  • Custom Actions are a combination of custom pages and custom scripts that are used to include tailored actions in workflow rules. Custom actions let you add workflow actions to your application in addition to those available by default (alerts, tasks, field updates, webhooks, and custom functions).
  • Custom actions help you build customizations that include provisions for the end users to apply personalizations.
  • When the same functionality is to be implemented using workflow rules but with different personalised end results, custom actions are required.

 Create Custom Actions

We will use the following example to illustrate the use of custom actions: Enable the app user to send emails to leads with personalized messages.

To create a custom action:

  1. Log in to Zoho Developer Console and click Extensions for Zoho CRM.
  2. Select the extension to modify and click Edit.
  3. Click Automate in the left pane and select Custom Actions.
  4. In the Custom Actions page, click Create an Action.
    Create a Connected App  if it has not already been created.
  5. Provide a name for the custom action in the Custom Action Name field, a Description, and click Next.
  6. Provide the resource path for the Custom Page (Main.html) in the SandBox URL field.
    This is the relative path to the Custom Page.
  7. Click Next.
  8. Click Create Function.
  9. The Deluge Script Editor will be displayed. Write a custom function (See also Deluge Script - Reference Guide ) to send an email. This custom function will be executed when associated with a workflow rule. The values from the custom page (Main.html) will be passed as a JSON object to this custom function.
  10. Click Save & Close.
    The values 'To', 'Subject', and 'Message' are set in the config map in the custom page (Main.html). 
    ZOHO.embeddedApp.init ( )
              .then (function ( ) {
                       ZOHO.CRM.ACTION.setConfig (
                       {
                                  To : "${!Leads.Email}",
                                  Subject : document.getElementById("subject").value,
                                  Message : document.getElementById("msg").value
                       })
               });
  11. Click Save.

 Associate with Workflow Rules

To use the custom action in your application, publish the extension and install it in your CRM application. Create a workflow rule to send email to leads from the 'State' Texas and invoke the script created through custom action.

To associate a custom action to a workflow rule:

  1. Access your CRM application.
  2. Go to Setup > Automation > Workflow Rules.
  3. In the Workflow Rules page, click Create Rule.


    The custom action you created will be listed along with the list of default actions.
  4. When you select the custom action, the created custom page will be displayed to the users so they can input and submit the values required to execute the action.
  5. Provide a name for this instance of the custom action 'Email Template' and click Save and Associate.
  6. Click Save in the New Rule page.
    Similarly, you can create a different workflow rule and use the same custom action (Email Template) to email a different personalised message to leads.

Note

  • You can create up to 5 custom actions per extension. 
  • You can associate up to 3 custom actions per workflow rule. 

 Manage Custom Actions

 Edit Custom Actions

  1. Click Automate in the left pane and select Custom Actions.
  2. In the Custom Actions page, click the edit icon [] next to the name of the custom action.
  3. Make the necessary changes and click Save. You can also modify the custom function.

 Delete Custom Actions

Until the extension is published, you can delete the custom actions that you have created.

  1. Click Automate in the left pane and select Custom Actions
  2. In the Custom Actions page, click the delete icon [] next to the name of the custom action.
  3. Click OK to confirm deletion.

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeveloper.com