When you consider the data that you add in Zoho CRM, many a time you may want to enter the same value for two different fields in a record.
Some of these scenarios are as follows :
- If the customer only has one phone number, the information in the 'Phone' and 'Mobile' fields could be identical.
- If the client uses a single email address, the 'Email' and 'Secondary Email' fields might both have the same information.
- We have two separate sections in several CRM forms, such as the 'Address' field and the 'Permanent address' field. In the vast majority of cases, they are identical.
- Consider a form that contains information about a person's educational background. If the contact information prompts you to enter the address of the institution under the Bachelors' and Masters' sections, and you wish to enter the same address in both sections, doing so manually is tiring. It will be simpler if the values are automatically populated.
All the above - mentioned specific scenarios can be achieved in Zoho CRM by using custom functions. Initially, a button is created and the custom function is integrated within the button. Once the button is clicked, the actions written in the custom function gets triggered accordingly.
Step for creating a button :
- Go to Setup > Customization > Modules and Fields > Select the required module > Links and button > +New Button.
- Provide the needed details and choose the viewing positioning accordingly. (Preferable - View page)
- From the drop-down menu that appears, select Writing Function.
Now for creating a custom function, follow these steps:
- Provide a name for the custom function and other essential details.
- Click on 'Edit Arguments'.
- Based on the examples map the required parameters. Module ID mapping is common for all the examples.
For example 1 : Similar contact number
Enter the name as phone and select the value from the desired module.
For example 2 : Similar email address
Enter the name as email and select the value from the desired module.
For example 3 : Similar address
Enter the mapping name for all the fields in the address and select the value from the desired module.
For example 4 : Similar institution
Enter the name as institution and select the value from the desired module.
4. Now, type the code given below.
mp = Map();
//For example 1
mp.put("Mobile",phone);
//For example 2
mp.put("Secondary_Email",email);
//For example 3
mp.put("Permanent_City",city);
mp.put("Permanent_Street",street);
mp.put("Permanent_Country",country);
mp.put("Permanent_State",state);
map.put("Permanent_Zip_Code",zipcode);
//For example 4
mp.put("Senior_High_School_Details",highschool);
//Common for all examples
autoPopulate = zoho.crm.updateRecord("Leads",lead_id.toLong(),mp);
info mp;
info autoPopulate;
return "Fields are populated successfully";
5. Save the changes.
6. Select which profiles will be able to view this button.
Execution :
Example 1 :
Example 2 :
Example 3 :
Example 4 :
Note :
This function is already available in the Quotes module. Furthermore, they can transfer data in both directions. That is, information from field 'A' can be moved to field 'B,' and vice versa.
To implement a similar function in Leads, Contacts and any other module of your choice, the above function will be helpful.