Auto-create tasks to review and convert quotes

Create a task automatically upon modifying a custom date field in the quote record to review and convert customer quotes in your CRM.

Businesses can ensure accurate pricing and identify areas for improvement in meeting customer needs by reviewing their sales quotes. However, reviewing numerous quotes for conversion can be challenging for salespeople. One effective method for reviewing quotes is to create tasks and complete them later. By doing so, sales teams can stay organized and efficient, ensuring no potential quotes slip through the cracks.

Presently, it's not possible to automatically create tasks for sales quotes in your CRM. However, you can write a custom function that will allow you to create a task upon modifying a custom date field within the quote record. Read the section below 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 date field and name it "Review On" in the Quotes module. This is where you will enter the date for the quote review. This date will also be considered the task's due date. Learn more
  • Create a workflow rule for the Quotes module that triggers every time the Review On field is modified. 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 Quotes module.

  1. Navigate to Setup > Customization > Modules and Fields.
  2. Click the Quotes module to open the layout editor.
  3. Drag and drop the date field from the New Fields tray to the desired section of the layout.
  4. Name the date field (e.g. "Review On"), enter the options, and define its properties as required.
  5. Once you have finished, select Done and then click Save and Close.
Add Custom Field

Create a workflow rule

  1. Navigate to Setup > Workflow Rules > +Create Rule.
  2. Select Quotes from the module dropdown list.
  3. Provide a name for the rule. For example: "Create task for quote review".
  4. Add a description (optional) and then click Next.
  5. In the Execute this workflow rule based on section, choose Record Action, then select Edit from the dropdown.
  6. Select Specific field(s) get modified and specify the condition as "When <Review On> is modified to <any value>".
  7. In the Which quotes would you like to apply the rule to? section, choose All Quotes, then click Next.
  8. Under Instant Actions, select Function and Write your own.
  9. Provide a name and description, if necessary, for the function.
  10. On the Deluge Script Editor, do the following:
    1. Copy and paste the code given below.
    2. Click Edit Arguments.
    3. Choose Quotes - Quote Id and name it as quoteId, then click Save.
    4. Click Save & Execute Script.
  11. Click Save on the workflow rule page.

The code

Code Copied
//Fetch the quote details using their ID
quoteDetails = zoho.crm.getRecordById("Quotes",quoteId);

//Use the current logged in user's email address to fetch their full details
userEmail = zoho.loginuserid;
CRMmap = Map();
CRMusers = zoho.crm.invokeConnector("crm.getusers",CRMmap);
CRMuserlist = CRMusers.getJSON("response").getJSON("users").toJSONList();

//Loop through the user list and look for a match to pull additional info for each user
for each  user in CRMuserlist
{
	if(user.getJSON("email") == userEmail)
	{
		CRMid = user.getJSON("id");
		firstName = user.getJSON("first_name");
		lastName = user.getJSON("last_name");
		taskOwnerName = firstName + " " + lastName;
		taskOwner = {"name":firstName + " " + lastName,"id":CRMid};
	}
}

//Set the task fields
quoteSubj = quoteDetails.get("Subject");
quoteNum = quoteDetails.get("Quote_Number");
quoteReviewOn = quoteDetails.get("Review_On");
taskText = "Review ";

//Set the task subject (e.g.    )
taskSubject = taskText + " Quote #" + quoteNum + " - " + quoteSubj + "";

//Map task fields
tMap = Map();
tMap.put("$se_module","Quotes");
tMap.put("What_Id",quoteId);
tMap.put("Subject",taskSubject);
tMap.put("Owner",taskOwner);
tMap.put("Due_Date",quoteReviewOn);
tMap.put("Priority","Normal");
tMap.put("Status","Not Started");

//Create the task
createResp = zoho.crm.createRecord("Tasks",tMap);

//Empty the custom date field for reuse
quoteMap = Map();
quoteMap.put("Review_On","");
resp = zoho.crm.updateRecord("Quotes",quoteId,quoteMap);

Notes

  • Make sure to use the accurate API names for their corresponding fields in the code snippet. Learn more
  • The task will be auto-assigned to the user who updates the review date on the quote.
  • You can customize the code snippet to specify the reminder date and input other task specifics.
  • Salespeople can access their My Today & Overdue Tasks view to see which quotes they need to review for the day.
  • The above script is an example of creating a task to review sales quotes at a later date. You can use this code to create a task for any other module by changing the module, field names, and other parameters.

Tip

  • Configure and test the function in a sandbox to ensure that further development doesn't disrupt your production environment.

Test the solution

  1. Go to the Quotes module and click on the desired quote. 
  2. On the Quote Details page, enter a date in the Review On field.
    The workflow rule will be triggered.
  3. Check whether a new task gets created for the quote, including the subject, owner, due date, priority, and status, as specified in the function.

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

  • ModuleQuotes
  • Trigger PointWorkflow Rule
  • EditionEnterprise and above
  • ComplexityHigh
  • Implementation Time60 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!