Edition: Enterprise | Industry: Travel | Feature: Workflow rule and Functions
Scenario
Joshua Baker is a sales manager at an online travel agency that offers customized tour packages. The agency has a webform on its website through which interested people inquire about tour packages. Qualified inquiries (leads) are converted as contacts and a new deal is created. However, during this process, some duplicates are created in the database. For example, Kane Wilson inquired about and purchased a tour package last summer. Now, though he is already a customer in the database, when he makes another inquiry through the webform, his details are again captured as a new lead.
Requirements
Joshua wants to:
- Identify the duplicate entries among customers and new inquiries
- Merge the duplicate entries
Solution
The webform captures the new inquiries in the Leads module and the customers (converted leads) in the Contacts module. Joshua creates a checkbox field named "Duplicates" in the Leads module.
1. Identifying duplicates between Leads and Contacts modules
The deduplication tool can identify duplicates within a single module, but you can use a custom function to do it across multiple modules. So, in this case every time a new lead enters through the webform, a record is created in the Leads module and a custom function checks for duplicates in the Contacts module. In case a duplicate is found, the Duplicate checkbox field is marked.
- Go to Setup > Developer Space > Functions.
- Write the below function in the Deluge Script Editor.
relcont = zoho.crm.searchRecords("Contacts", "(Email:equals:" + email + ")");
relcontsize = relcont.size();
if (relcontsize>0)
{
update = zoho.crm.updateRecord("Leads", leadid.toString(), {"Duplicate":true});
}
- Click Edit Argument.
- Set the arguments to be used in the script.
- Click Save.
Module
| Leads
|
Rule Name
| Duplicate check
|
When to execute
| Record action > Create
|
Condition
| All leads
|
Actions
| Functions > Duplicate
|
2. Merging the duplicate records
In the Leads module, create a list view to filter the duplicate entries (Criteria: Duplicate is Selected). During Lead Conversion, you can either merge it with the existing contact or create a new contact.