Creating a new customer account in your CRM typically involves several activities, such as onboarding sessions, product installation and walkthroughs, and billing procedures. Businesses often track these activities by assigning tasks to various team members. However, managing and completing these tasks can become overwhelming, especially as they start to stack up. In such cases, displaying the earliest due date for upcoming tasks in the account record helps salespeople identify which accounts require immediate attention. Furthermore, adding the due date as a column provides an overview of each account's work status in the list view. While Zoho CRM does not offer a straightforward method or ready-made automation to do this, our low-code tools can make it possible.
If your business follows this practice, you can create a custom function that updates the earliest due date among all upcoming tasks associated with an account in a custom date field. Once created, link it with a workflow rule for tasks that will automatically update the date field in the account every time a task is created or modified.
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 Date field in the Accounts module. This field will hold the earliest due date of upcoming tasks. Learn more
- Create a workflow rule for the Tasks module that triggers when creating or editing a task. Learn more
- Write a custom Deluge function and link it with 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 adding the custom date field to the Accounts module.
- Navigate to Setup > Customization > Modules and Fields.
- Click the Accounts module to open the layout editor.
- Drag and drop the Date field from the New Fields tray to the layout.
- Name the date field (e.g., "Next Task Due") and define its properties as required.
- Once you have finished, click Save and Close.
Create a workflow rule
Next, you need to write and connect a custom function with a workflow rule.
- Navigate to Setup > Workflow Rules > +Create Rule.
- Select Tasks from the module dropdown list.
- Provide a name for the rule. For example: "Update earliest due date of tasks".
- Add a description (optional), then click Next.
- In the Execute this workflow rule based on section, choose Record Action, then select Create or Edit from the dropdown and click Next.
- In the Which tasks would you like to apply the rule to? section, select All Tasks, then click Next.
- 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 Accounts - Account Id, name it accountId, and click Save.
- Click Save & Execute script.
- Click Save on the workflow rule page.
The code
related_tasks = zoho.crm.getRelatedRecords("Tasks","Accounts",accountId);
info related_tasks.size();
dlist = List();
if(related_tasks.size() > 0)
{
for each task in related_tasks
{
if ( task.get("Status") != "Completed" )
{
dlist.add(task.get("Due_Date"));
}
}
ldate = dlist.sort(true).get(0);
info ldate;
mp = map();
mp.put("Next_Task_Due",ldate);
up = zoho.crm.updateRecord("Accounts",accountId,mp);
info up;
info mp;
}
Notes
- Use the accurate API name of the custom date field in the code snippet (e.g., "Next Task Due"). Learn more
- The code above is an example of how to automatically retrieve and display the earliest due date among all upcoming tasks associated with an account in its custom date field. You can use this code to update fields in any other module, such as Contacts or custom, by modifying the module name and parameters.
Tip
- Configure and test the function in a sandbox to ensure that further development doesn't disrupt your production environment.
Test the solution
- Click the Accounts tab.
- Open an account record in which you wish to view the due date of the upcoming task.
- On the Account Details page, navigate to Open Activities, click the Add (+) icon, and select Task under the Related List menu.
- Enter the task information and the due date, then click Save.
The workflow rule will be triggered. - Check whether the Next Task Due field was updated with the due date of the task created above.
- Create additional tasks with varying due dates to ensure the Next Task Due field shows the earliest due date among all tasks.
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