In organizations where teams work across different time zones, it is common to include a custom time zone field in modules such as Contacts, Leads, and Deals. Knowing a prospect's time zone—whether it's PST, IST, or EST—helps prevent outreach at inappropriate times and ensures that regional sales reps are assigned appropriately.
What if this time zone context could be readily available for new tasks created within these modules? This is where a custom function can be helpful, particularly when combined with a workflow rule.
All you need to do is write a custom function that triggers whenever a new task is created. The function automatically inherits the time zone from the related record or contact and populates it in the task. This eliminates the need for sales reps to manually look up and copy the time zone from the related CRM record into every new task. Sound interesting? Read on to learn more.
Permissions and availability
- Users with the Modules Customization permission can add custom fields.
- Users with the Manage Automation permission can create and update workflow rules.
- Users with the Manage Extensibility permission can create custom functions.
- Users with the Manage Sandbox permission can manage the sandbox.
Requirements
- Add a custom picklist field to the Tasks module. This field will store the time zone inherited from the related record. Learn more
- Ensure that the Time Zone picklist field already exists in the Leads, Deals, Contacts, and Accounts modules.
- Create a workflow rule for the Tasks module that triggers whenever a new task is created. Learn more
- Write a custom Deluge function that inherits the time zone from the related record and populates it in new tasks, then link it to the workflow rule. Learn more
- Test the workflow rule in a sandbox before deploying it to your production environment. Learn more
Add a custom field
The first step is to add a custom picklist field to the Tasks module:
- Navigate to Setup > Customization > Modules and Fields.
- Click the Tasks module to open the layout editor.
- Drag and drop the picklist field from the New Fields tray to the desired section of the layout.
- Name the picklist field (e.g., "Time Zone"), add the time zone values as picklist options, define its properties as required and click Done.
- Once you've finished, click Save and Close.
Create a workflow rule
Next, create a workflow rule for the tasks module that triggers whenever a new task is created:
- Navigate to Setup > Workflow Rules > + Create Rule.
- Select the module as Tasks from the dropdown list.
- Provide a name for the rule. For example: "Inherit time zone from related record".
- Add a description, if required, then click Next.
- In the Execute this workflow rule based on section, choose Record Action, select Create from the dropdown list, and then click Next.
- In the Which tasks would you like to apply the rule to? section, select All Tasks, then click Done.
- Under Instant Actions, select Function and Write your own.
- Provide a name for the function, as well as a description, if necessary.
- In the Deluge Script Editor, do the following:
- Copy and paste the code provided below.
- Click Edit Arguments.
- Choose Tasks - Task Id, name it taskId, then click Save.
- Click Save & Execute Script.
- Click Save on the workflow rule page.
The code
taskDetails = zoho.crm.v8.getRecordById("Tasks",input.taskId.toLong());
info "td:" + taskDetails;
info "se:" + taskDetails.get("What_Id");
whatid = ifnull(taskDetails.get("What_Id"),"");
whoid = ifnull(taskDetails.get("Who_Id"),"");
if(whatid != "")
{
recordid = ifnull(taskDetails.get("What_Id"),"").get("id");
module = ifnull(taskDetails.get("$se_module"),"");
getDetails = zoho.crm.v8.getRecordById(module,recordid);
timezone = ifnull(getDetails.get("Time_Zone"),"");
mp = Map();
mp.put("Time_Zone",timezone);
update = zoho.crm.v8.updateRecord("Tasks",taskId,mp);
info mp;
info update;
}
if(whoid != "")
{
contid = ifnull(taskDetails.get("Who_Id"),"").get("id");
getDetails = zoho.crm.v8.getRecordById("Contacts",contid);
timezone = ifnull(getDetails.get("Time_Zone"),"");
mp = Map();
mp.put("Time_Zone",timezone);
update = zoho.crm.v8.updateRecord("Tasks",taskId,mp);
info mp;
info update;
}Notes
- Make sure to use the accurate API name (e.g., "Time Zone") of the fields used in the code snippet. Learn more
- Add all available time zone field values from the other modules to the Tasks module to ensure they're inherited without issues.
- The code above demonstrates how to automatically inherit time zones for new tasks from their related CRM records, such as deals, leads, contacts, and accounts. You can adapt this code to inherit other field values by modifying the module names and parameters.
Tip
- Configure and test the solution in a sandbox to ensure that further development doesn't disrupt your production environment.
Test the solution
- Navigate to the Tasks module and click Create Task.
- In the Create Task page, associate the task with a lead, contact, or deal that already has a Time Zone value populated.
- Enter the required task details and click Save.
The workflow rule will be triggered. - Open the newly created task and verify that the Time Zone field has been automatically populated with the time zone value from the associated record.
Did you find this useful? Try it out and let us know how it works. Share this with your team if they'd benefit from it! If you have questions, please don't hesitate to contact us.
More info
- ModuleTasks
- Trigger PointWorkflow Rule
- EditionEnterprise and above
- ComplexityMedium
- Implementation Time30 minutes

Looking for a custom solution?
Contact us, we will help enhance your productivity at lightning speed.
SUBMIT REQUEST