100%

Data Bind Fields between Modules in Zoho CRM

Difficulty: Beginner
Estimated reading time: 15 mins
Estimated implementation time: 45 mins

A Deluge script that data binds two of the same fields in two separate modules – both fields will always reflect any updates that are made to each of the corresponding fields.

Core Idea

This is useful when you have a similar field in two separate modules. For example, you have a field called “Company Overview” in the Accounts module and also in Deals for ease of reference (or whatever other reason it may be). Because they are both similar fields, you would want the information to be accessible and constantly up to date in both modules. This script enables you to edit the field in either module and have the changes reflected in both modules.

Configuration

For this function to work both ways, you will need to set up two custom functions and workflow rules (one for each module).

  • Worfklow Rule 1
    • Triggers the custom function below when an Account is created/ edited.
    • Custom Function 1: When the “Company Overview” field in an Account is updated, the similar field in all related Deals gets the updated with the same value.
  • Workflow Rule 2
    • Triggers the custom function below when a Deal is created/ edited.
    • Custom Function 2: When the “Company Overview” field on a Deal is updated, the similar field in the Account gets updated, along with all other Deals related to the same Account.

Tutorial

 				 					account = zoho.crm.getRecordById("Accounts",accountid);  //Get Company Overview Value  company_overview = account.get("Company_Overview");  //Get the related Deal IDs  deal = zoho.crm.getRelatedRecords("Deals","Accounts",accountid);  dealids = List();  for each  d in deal  {  	dealids.add(d.get("id"));  }  //Update Company Overview Value in the similar field in all related Deals  for each  id in dealids  {  	update = zoho.crm.updateRecord("Deals",id,{"Company_Overview":company_overview});  	info update;  } 				 			

Replace “Company_Overview” with the relevant field name.

Want to learn even more? Sign up for one of our Zoho courses!


 				 					deal = zoho.crm.getRecordById("Deals",dealid);  //Get Company Overview Value  company_overview = deal.get("Company_Overview");  //Get the Account ID  accountid = deal.get("Account_Name").get("id");  //Update Company Overview value in the similar field in the Account  update = zoho.crm.updateRecord("Accounts",accountid,{"Company_Overview":company_overview});  //info update;  //Get other related Deal IDs of the Account  deals = zoho.crm.getRelatedRecords("Deals","Accounts",accountid);  dealids = List();  for each  d in deals  {  	dealids.add(d.get("id"));  }  //Update the Company Overview value in all other Deals related to the Account  for each  id in dealids  {  	if(id != dealid)  	{  		update2 = zoho.crm.updateRecord("Deals",id,{"Company_Overview":company_overview});  		info update2;  	}  } 				 			

Replace “Company_Overview” with the relevant field name.

Click here to copy these scripts. For more Zoho-wizardry, check out our GitHub page.

More Free Resources

Deluge Tips – Null Check

When scripting, ask yourself this question – will this value ever be null? If it’s a yes, that’s a place for a null check! Here are 3 tips and best practices to help you kickstart the habit....

Read More »