It's common for businesses to sell products along with optional annual maintenance contracts (AMCs). These contracts ensure ongoing service and support for the product after the standard warranty expires. AMCs usually last for one to three years and have specific start and end dates. Salespeople typically enter AMC details—including type, cost, and coverage period—when preparing quotes for customers.
However, when entering this information, they may accidentally input overlapping dates. For example:
- Row 1: AMC Year 1 | Aug 1, 2025 – Jul 31, 2026
- Row 2: AMC Year 2 | Aug 1, 2026 – Jul 31, 2027 ✔️
- Row 3: AMC Year 3 | Jul 30, 2027 – Jul 29, 2028 ❌ (overlaps)
This can lead to confusion in service delivery, result in incorrect billing, and cause inaccuracies in revenue recognition. Wouldn't it be helpful if your CRM alerted salespeople when the start date in a new row is earlier than the end date in the previous row? Fortunately, our low-code tools can make this possible.
Since this requirement is unique to a limited number of businesses, we support it through our low-code tools. Using a combination of custom fields and a client script, you can automatically prevent the entry of overlapping dates in subform rows. The client script will display a real-time error message and enable salespeople to re-enter the correct dates.
Permissions and availability
- Users with the Modules Customization permission can add custom fields.
- Users with the Manage Extensibility permission can create client scripts.
- Users with the Manage Sandbox permission can manage the sandbox.
Requirements
- Add two Date fields to the Quoted Items subform in the Quotes module. The fields will hold AMCs' start and end dates. Learn more
- Create a client script that triggers whenever you update any value in the quote's subform cell. Learn more
- Test the function in a sandbox environment before deploying it to your production environment. Learn more
Add custom fields
The first step is adding the custom date fields to the Quotes module.
- Navigate to Setup > Customization > Modules and Fields.
- Click the Quotes module to open the layout editor.
- In the Quoted Items subform section, click Add Field and select Date.
- Name the date field (e.g., "Start Date") and define its properties as required.
- Click Add Field again, and choose Date.
- Name the second date field (e.g., "End Date") and define its properties as required.
- Once you've finished, select Done, then click Save and Close.
Create a client script
The next step is to create a client script in your Zoho CRM account:
- Navigate to Setup > Developer Hub > Client Script > +New Script.
- Provide a name for the script. For example: "Check date overlaps".
- Add a description (optional).
- In the Category Details section, do the following:
- Category - Choose Module.
- Page - Choose Create Page.
You may also need to add the script for the Edit Page. - Module - Choose Quotes.
- Choose the layout.
It can be Standard or any other custom layout of the quotes module.
- In the Event Details section, do the following:
- Type - Choose Subform Event
- Field - Choose Quotes Items
- Event - Choose onCellChange.
- Click Next.
The Client Script IDE will open. - Copy and paste the script provided below.
You can customize the script, if needed. - Click Save and Close to save the client script.
The code
console.clear();
if (index >0)
{
var prevEndDate= ZDK.Page.getSubform("Quoted_Items").getRow(index-1).getCell("End_Date").getValue();
console.log("prevEndDate : ", prevEndDate);
var prevEnd = new Date(prevEndDate);
console.log("prevEnd : ", prevEnd);
var currentStart = new Date(row_data.Start_Date);
console.log("currentStart : ", currentStart);
if (currentStart <= prevEnd)
{
ZDK.Client.showMessage('Error message', { type: 'Start date should be later than the previous end date.' });
return false;
}
}Notes
- Make sure you update the script with the accurate API name of the corresponding fields (e.g., "Start Date"). Learn more
- Customize the error message displayed when start and end dates overlap in the above script.
- You may also need to include the script on the Edit and Clone pages to ensure that any product updates check for overlapping dates.
- The script above is an example of validating overlapping dates entered in subform rows by ensuring that a start date is later than the previous end date. You can use this client script code for any other module, such as Deals or custom modules, 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
- Navigate to Quotes > +Create Quote.
- On the Quote Details page, enter the required information, including the product name, start date, and end date across multiple rows in the Quoted Items subform.
The client script will be triggered. - Check for any error messages that may appear.
- Enter a start date in one row that overlaps with the end date from the previous row, and verify if the error message is displayed as specified in the script.
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 PointBrowser
- 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