To make informed sales decisions, you need complete context when looking at contacts in your CRM. For instance, you need to be able to view important information like the physical address of the contact's account, website, type of account, assigned sales representative, territory, and other custom fields. Even though the information is in your CRM, you can't view it on the same page as the contact. This is when our low-code tools can come in handy.
To view account-related contextual information on the contact details page, you can create a custom function and connect it to a new related list in the Contacts module. Once done, you don't have to open the contact's account in a new tab to view their information.
Permissions and availability
- Users with the Manage Extensibility permission can write custom functions.
- Users with the Modules Customization permission can add related lists.
- Users with the Manage Sandbox permission can manage the sandbox.
Requirements
- Write a custom function using Zoho's Deluge scripting language that fetches the required account-related field information. Learn more
- Add a related list within the contact details page and include the custom function to display the account-related information. Learn more
- Test the function in a sandbox environment before deploying it to your production environment. Learn more
Write a custom function
The first step is to write the custom function that will be linked to the related list.
- Go to Setup > Developer Space > Functions > +New Function.
- Provide a name and display name for the function. For example: "View Account Details".
- Set the category of the function as Related List.
- Copy and paste the code provided below.
- Click Edit Arguments.
- Enter the parameter name as "accountId" and set the type as "string".
- Click Save.
The code
//Get account information
accountMap = zoho.crm.getRecordById("Accounts",accountId);
//Get the required account variables
accountName = accountMap.get("Account_Name");
accountAddress = accountMap.get("Billing_Street") + " " + accountMap.get("Billing_City") + " " + accountMap.get("Billing_State") + " " + accountMap.get("Billing_Code");
accountWebsite = accountMap.get("Website");
accountType = accountMap.get("Account_Type");
//prepare the XML
rowVal = 0;
responseXML = "";
responseXML = responseXML + "<row cnt='" + rowVal + "'><FL val='Account Name'>" + accountName + "</FL><FL val='Address'>" + accountAddress + "</FL><FL val='Website'>" + accountWebsite + "</FL><FL val='Account Type'>" + accountType + "</FL></row>";
return responseXML;
Notes
- Make sure to use the accurate API names for their corresponding fields in the code snippet. Learn more
- Add the required field values in the XML to view more details about the accounts.
Add a related list
The final step is to add a related list to the contact details page to display the contextual account information.
- Open a contact record to view its details.
- Go to the Related List panel on the left and click the Add Related List option.
- Select Functions in the pop-up window.
- Select Add Now, corresponding to the function you created in the previous steps.
- Specify a name for the related list. For example: "Account Details".
- Press # to fetch the merge field and map the argument as accountId = Accounts > Account Id.
- Click Save.
Tip
- Click the Reorder icon next to the related list to move the Account Details section to the required location on the page.
Test the solution
- Go to the Contacts module and click on the desired contact.
- On the Contact Details page, look for the Account Details related list section. It will display information about the related account as specified in the code snippet.
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
- ModuleContacts
- Trigger PointRelated List
- EditionEnterprise and above
- ComplexityEasy
- Implementation Time15 minutes

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