Client Scripts
Client Scripts are JavaScripts that are executed in a client module to automate an action based on a trigger from the client. For example, client scripts are mostly used for filling online forms where the data field displayed or auto-filling of data will be done based on an user action in the form.
Enable Client Scripts
Client Scripts will be disabled for the users in an organization by default. The administrators need to enable it for the users to start creating and using the the Client Scripts on their email client interface in Zoho Mail. Learn more
Client Scripts in Zoho Mail
Client Script in Zoho Mail will help you create JavaScripts and execute them in the email Compose, Preview and Listing windows to automate an action based on the triggers from the email client interface.
My Scripts - These scripts are the ones that are created by the users in the organization to execute them in their respective email account's client interface.
Org Scripts - These scripts are the ones that are created by the users in the organization and shared to the organization for all the users to make use of the script in their email account's client interface. Once shared to the organization, these scripts should be approved by the organization administrator to have it shared to other users in the organization for them to enable and use it.
Mandatory Scripts - These scripts are the organization scripts that are marked as mandatory scripts by the script creator and approved by the organization admin. These scripts will be automatically enabled once approved by the administrator and the organization users will not have an option to disable the script.
Create a Client Script
- Log in to Zoho Mail.
- Navigate to Settings > Integrations > Developer Space > Client Scripts.
- Click on Create New Script.
- Provide a Name and Description for the script
- Choose the email client module location, where the script should be executed.
- Mail Compose
- Mail Preview
- Mail Listing
- Choose the trigger for the script to be executed
- OnSend - Available only in the Mail Compose module. The script will be executed when the Send button is clicked to send an email.
- OnChange - Available only in the Mail Compose module. The script will be executed based on a value update in the any of the fields of the compose window.
- OnLoad - Available in Mail Compose, Mail Preview, and Mail Listing modules. The script will be executed on loading any of the modules under which the script is created.
- You can choose to Make script mandatory to mandate the script for the users in the organization upon approval by the organization administrator.
- If the script that you create will require data fetch from another application, a Connector should be configured for the same to execute the script.
- You can choose the connector by clicking on the Choose Service name option.
- The Connectors available in your account will be listed and you can choose the appropriate one.
- You can also choose to create a new connector by clicking on the Create Connection button.
- Edit the Code Snippet to customize the Client Script based on your requirement.
- If the script contains any URL to which the API call made by the script will be redirected to, a confirmation dialog will be shown for you to Trust the domain using which the API call will be made.
- The organization users also will be intimated of the Trusted Domain redirection when they choose to enable an Org Script for their email account.
- Once you edit the code snippet, click Save.
- You can also choose to Save and Test run the script to check for correct execution.
Once saved, it will be available under the My Scripts section for you to enable and use it in your email account.
Edit a script
To edit a script already created, navigate to the My Scripts section and click on script that you want to edit. Click on the Edit icon on the top right corner. Make the necessary changes and click Save.
Delete a script
To delete a script, navigate to the My Scripts section and click on script that you want to delete. Click on the Delete icon on the top right corner. Confirm the delete action by clicking on OK on the confirmation dialogue box.
Share to Org
Once you create a script, you can choose to share it with your organization for the users in your organization to use the script in their email accounts. To share a script with your organization, navigate to the My Scripts section and click on script that you want to share with your organization users. Click on the Share to org button.
The script will be sent for approval by the organization administrator. Once approved it will be listed under the Org Scripts section for the users to enable and use it based on their requirement.
Execution order
The script execution order will help you to sequence the order execution pattern in a module based on the triggers on the client interface. To edit the execution order of the scripts, navigate to Settings > Integrations > Developer Space > Client Scripts. Click on the Set Execution Order option. Choose the module and trigger. Click Search.
The scripts for the chosen module and trigger will be listed for you to re-order the execution order. You can drag and drop to re-order.
Note: You cannot change the execution order of the mandatory scripts.