Sync task progress to deal stages

Automatically sync task status updates to their associated quote and deal stages in your Zoho CRM account to ensure real-time alignment across records without manual effort.

In many sales organizations, quotes and deals work in tandem throughout the sales process. When a customer accepts or rejects a quote, the corresponding deal stage should reflect that decision immediately. In some organizations, quote-related activities, such as contract signing, are managed by creating tasks for quotes in Zoho CRM. For example, when a prospect either signs or declines a contract, the sales rep updates the task's custom field to either "closed won" or "closed lost", and they expect both the related quote's stage and the corresponding deal's stage to be automatically updated accordingly. The goal is to automatically push that status change all the way to the deal.

To accomplish this, you need to create two workflow rules that update fields. However, if you take a cursory look at your CRM, you'll notice that workflow rules triggered by automated field updates from another workflow often fail to cascade to subsequent workflows. This restriction exists to prevent infinite loops but creates operational inefficiencies, forcing sales teams to update stages in each record manually, which in turn leads to data inconsistencies and delayed pipeline visibility—but not anymore!

To spare you the effort of manual work and ensure real-time synchronization, you can create a workflow rule linked to a custom function that automatically updates the quote and deal stages whenever the custom status field on their associated task is changed. 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 hold the different stages, similar to those in the Quotes and Deals module. Learn more
  • Create a workflow rule for the Tasks module that triggers whenever its custom picklist field is updated. Learn more
  • Write a custom Deluge function that updates the task's associated quote and deal stage to the chosen value, and link it to the workflow rule. Learn more
  • Test the workflow rule in a sandbox before deploying it in your production environment. Learn more

Add a custom field

The first step is to add the custom picklist field to the Tasks module.

  1. Navigate to Setup > Customization > Modules and Fields.
  2. Click the Tasks module to open the layout editor.
  3. Drag and drop the picklist field from the New Fields tray to the desired section of the layout.
  4. Name the pick list field (e.g., "Deal Progress"), add the stage values from the Quotes and Deals modules as pick list options, define its properties as required, and click Done.
  5. Once you have finished, click Save and Close.

Create a workflow rule

Next, create a workflow rule for the Tasks module that triggers whenever its custom picklist field is updated.

  1. Navigate to Setup > Workflow Rules > + Create Rule.
  2. Select the module as Tasks from the dropdown list.
  3. Provide a name for the rule. For example: "Sync task progress to deal stages".
  4. Add a description, if required, then click Next.
  5. In the Execute this workflow rule based on section, do the following:
    1. Choose Record Action, then select Edit from the dropdown.
    2. Check the box for Repeat this workflow whenever a task is edited option.
    3. Choose Specific field(s) gets modified from the dropdown, then enter the condition "When <Deal Progress> is modified to <any value>".
    4. Click Next.
  6. In the Which tasks would you like to apply the rule to? section, specify the condition as "<Deal Progress> <is not empty>", then click Next.
  7. Under Instant Actions, select Function and Write your own.
  8. Provide a name for the function, as well as a description, if necessary.
  9. In the Deluge Script Editor, do the following:
    1. Copy and paste the code provided below.
    2. Click Edit Arguments.
    3. Choose Quotes - Quote Id and name it as quoteId.
    4. Click the + icon to add more arguments.
    5. Choose Tasks - Deal Progress, name it dealProgress, then click Save.
    6. Click Save & Execute Script.
  10. Click Save on the workflow rule page.

The code

Code Copied
if(!quoteId.isNull())
{
	stageMap = Map();
	stageMap.put("In Progress","Negotiation");
	stageMap.put("Closed Won","Closed Won");
	stageMap.put("Closed Lost","Closed Lost");
	// Get the mapped stage value
	newStage = stageMap.get(dealProgress);
	mp = Map();
	mp.put("Stage",newStage);
	// Fetch Quote details to get the associated Deal
	quoteInfo = zoho.crm.getRecordById("Quotes",quoteId);
	dealinfo = quoteInfo.get("Deal_Name");
	if(dealinfo != null)
	{
		dealUpdate = zoho.crm.updateRecord("Deals",dealinfo.get("id"),mp);
		info "Deal Update Result: " + dealUpdate;
	}
	quoteUpdate = zoho.crm.updateRecord("Quotes",quoteId,{"Quote_Stage":newStage});
	info "Quote Update Result: " + quoteUpdate;
}

Notes

  • Make sure to use the accurate API name of the fields used in the code snippet (e.g., "Deal Progress"). Learn more
  • Replace the stage field values in the script with your organization's actual quote and deal stage values.
  • Add all available stage field values from quotes and deals to ensure they sync without issues.
  • The code above is an example of syncing task status updates to their associated quote and deal stages without using two separate workflows for field updates. You can use this code for any other module by modifying the module name 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

Follow the instructions provided below to test the solution in your sandbox account.

I. Create a deal record

  1. Navigate to Deals > Create Deal.
  2. On the Create Deal page, set the stage to Qualification and enter the other required fields.
  3. Click Save.

II. Create a quote linked to the deal

  1. On the Deal Details page, go to the Quotes related list and click New.
  2. Ensure the Deal field is pre-populated with the current deal.
  3. Set the Quote Stage to Draft and enter the other required fields.
  4. Click Save.

III. Create a task linked to the quote

  1. On the Quote Details page, navigate to the Open Activities related list and click Add New Task.
  2. Ensure that the Related To field is pre-populated with the current quote.
  3. Set the Deal Progress to None and enter the other required fields.
  4. Click Save.

IV. Update the task and verify automation

  1. Open the task record created in Step 3.
  2. Update the Deal Progress field from None to In Progress, then click Save.
  3. Navigate to the associated Quote record and check whether its stage is set to Negotiation.
  4. Navigate to the associated Deal record and check whether its stage is also set to Negotiation.
  5. Test with different Deal Progress values to ensure the automation triggers correctly.

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

Features used in the solution

Custom FieldWorkflow RuleDeluge ScriptSandbox
Story Image

Looking for a custom solution?

Contact us, we will help enhance your productivity at lightning speed.

SUBMIT REQUEST

Developers: Share your solution with our community!