When selling insurance, providing service contracts, or offering extended warranties, it's important to renew them with your customers to maintain a recurring revenue stream. However, keeping track of their expiry and setting up a follow-up process can be challenging. For example, you need to filter the deals whose renewals are due to expire in x days from now and assign them to your salespeople for follow-up. This is where a custom function coupled with a schedule can come in handy.
Simply write a function that updates a field in the deal records of a custom view whose contracts are due for renewal 30 days from today. This function can then be connected to a schedule that updates those deals at a specific time every day. Continue reading to learn more.
Permissions and availability
- Users with the Manage Extensibility permission can create connections and write custom functions.
- Users with the Modules Customization permission can add custom fields.
- Users with the Manage Views permission can create custom list views.
- Users with the Manage Automation permission can create and update schedules.
- Users with the Manage Sandbox permission can manage the sandbox.
Requirements
- Create a Zoho OAuth connection with the required scopes for your Zoho CRM account, as detailed in the "Create Connection" section below. Learn more
- Add a date field and a picklist field in the Deals module. The date field will hold the contract expiration date, and the picklist field will be updated to indicate follow-up status. Learn more
- Create a custom list view that lists the deal records whose contracts expire in 30 days. Learn more
- Create a new schedule that executes daily on a specified date and time. Learn more
- Write a custom Deluge function that updates the picklist field in the deal record. Learn more
- Test the schedule in a sandbox before deploying it in your production environment. Learn more
Create a connection
The first step is creating an OAuth connection in your Zoho CRM account.
- Navigate to Setup > Developer Space > Connections.
- Click Create Connection.
- Select Zoho OAuth under Default Services.
- Specify a Connection Name.
You must enter this name in the code snippet below. - Select the following Scopes to request access.
- ZohoCRM.mass_update.deals.UPDATE
- Click Create and Connect.
- Click Connect, then click Accept to confirm authorization of access for the scopes requested by the client.
Add custom fields
The next step is to add the custom date and picklist fields to the Deals module.
- Navigate to Setup > Customization > Modules and Fields.
- Click the Deals module to open the layout editor, and do the following:
- Drag and drop the Date field from the New Fields tray to the desired section on the layout.
- Name the date field (e.g. "Contract End Date") and define its properties as required.
- Similarly, drag and drop the Picklist field from the New Fields tray to the desired section on the layout.
- Name the picklist field (e.g. "Renewal Status") and define its properties as required.
- Once you have finished, click Save and Close.
Create a custom list view
The next step is to create a custom view that lists the deals whose contracts expire in 30 days from today.
- Click the Deals Tab.
- In the Deals Home page, move your mouse pointer to the list view's drop-down.
- Click the New Custom View link and do the following:
- Enter a name for the custom view. (e.g. "Contracts Expiring in 30 Days")
- Specify the criteria as "<Contract End Date> <Due in Days> = 30".
- Select the columns to be displayed in the view.
- Choose who can see this custom view.
- Click Save.
Create a schedule
The final step is to create a new schedule in your Zoho CRM account.
- Navigate to Setup > Automation > Schedules > +Create New Schedule.
- Provide a name for the schedule. For example: "Follow up deals for renewal".
- Click Add Description and enter a description if necessary.
- In the Function to be executed field, choose Writing Function.
- In the Create New Function window, do the following:
- Provide a name, display name, and description, if necessary, for the function.
- Select Deluge as the Language, then click Create.
- In the Deluge Script Editor, do the following:
- Copy and paste the code provided below.
- Click Save & Execute Script.
- Choose an Execution Start Date and time for the function to be executed.
- Choose the schedule frequency as Every day in the Frequency field.
- Click Save on the schedule page.
The code
mp = Map();
mp.put("Renewal_Status","In Progress");
inputList = List();
inputList.add(mp);
params = Map();
params.put("data", inputList);
params.put("over_write", true);
params.put("cvid", "xxxxx");
info "param : " + params;
response = invokeurl
[
url :"https://www.zohoapis.com/crm/v6/Deals/actions/mass_update"
type :POST
parameters: params.toString()
connection:"connectionname"
];
info "response : " + response;
Notes
- Replace "connectionname" with the name of the connection you specified while creating the connection (see the "Create a connection" section above).
- Replace "xxxxx" with the ID of the custom list view created in the above section. You can find this numeric ID in the URL of the custom view page.
- Make sure to use the accurate API names for their corresponding fields (e.g., "Deal Count") in the code snippet. Learn more
- The script above is an example of creating a follow-up action for deals with contracts expiring 30 days from today. You can use this code for any other module, such as invoices, by modifying the module name and other parameters.
Test the solution
- Once the schedule has been executed, open a deal record from the custom list view whose contract expires in 30 days.
- Check whether its Renewal Status field was updated with the value In Progress.
Tips
- Create a workflow automation that triggers when the "Renewal Status" field in deals is updated to "In Progress". Then, add an instant action to the rule to assign an owner and create a follow-up task.
- Configure and test the function in a sandbox to ensure that further development doesn't disrupt your production environment.
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
- ModuleDeals
- Trigger PointSchedule
- EditionEnterprise and above
- ComplexityHigh
- Implementation Time60 minutes

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