Working with Multi-Select Look Up fields in Zoho CRM

03.09.23 12:24 PM By Andy

What we are going to do

In this tutorial we are going to show you how two different ways to find the Linking Module API fields, and we are going to review an example of how to search for records in a Multi-Select Look Up field.

When you create a Multi-Select Look Up fields (MSLU), a new module called "Linking Module" is created. This module holds some basic information about how the two records are related. The Linking Module has it's own API name, so if you want to use it in a function, you have to know the API name. There are 2 ways you can get the API Name: searching in the CRM settings, or using a custom function.

Linking Module API Name

CRM Settings

This is seems like the easy way to do it, but it might be more complicated than using a custom function. The issue with this way is that you have to make some assumptions. Normally, your assumptions will be correct, but there's a small chance that the name of one of the modules linked by the Linking module was changed, and this could conflict with the setup.

Here's how to do it:
  1. In the CRM, go to the setup.
  2. On the search bar, look for "CRM API", and open the first result.
  3. Click on the "API names" sub-tab.
  4. Open any of the modules listed here.
  5. Now, on the "filters by" section, click on the modules field.
  6. If you scroll all the way down, you will find the Linking Modules.

The Linking Module API name is the module name "Contacts X Properties", but you have to replace the spaces with underscores like this "Contacts_X_Properties". Now, if any of the modules' names changed, this method might not work for you.

If you open any Linking Module, you will see the fields related to the module. We are going to use some of the fields in the example that you can find at the end of this article.

Custom function

This method is more complicated, but always gives you the correct Linking Modules API Names.

Add a connection:
  1. In the CRM, go to the Setup.
  2. Under "developer space", click on "connections".
  3. Click on "create connection".
  4. The service is "Zoho OAuth".
  5. Name the connection. We are going to use "linking_module_API".
  6. The scope is "ZohoCRM.settings.modules.ALL". Use the magnifier to easily find it.
  7. Click on "create and connect".
  8. Click on "connect" and allow any permissions you are requested.

Create the function:
  1. In the CRM, go to the Setup.
  2. Under "developer space", click on "functions".
  3. Create a new function with the "new function" button.
  4. Name the function.
  5. The category is "automation".
  6. Click on "create".
  7. Copy the first code listed below (called "Find Linking Modules API Names")
  8. Paste the code in the function.
  9. Replace the connection name with the name of the connection created in the previous step.
  10. Click on "Save & Execute".

The console will give you a list of the Linking Modules API names.
// Finding Linking Modules API Names
get_linking_modules_api = invokeurl
url :""
type :GET
modules_info = get_linking_modules_api.get("modules");
for each  item in modules_info
module_type = item.get("generated_type");
if(module_type == "linking")
module_api = item.get("api_name");
info module_api;

Example: Contacts and Properties Multi-Look Up Field

Let's say we have a custom module called Properties, that is related to the Contacts module. In the Contacts layout, we have a MSLU field where you can select multiple Properties.

If you try to get information from the MSLU using the "get" function, the result will be a string of text with all the Property names combined. There's no JSON with the Properties IDs or names.

Below you will find the function that you can copy and paste. We are going to explain each section individually. Make sure to add "contact_id" as an string in the arguments.

1) property_list = zoho.crm.searchRecords("Contacts_X_Properties","(Property_Contact:equals:" + contact_id + ")");
This line uses the "contact_id" to search for all the properties that are linked to the Contact via the Linking Module. The "Property_Contact" API name can found by following the steps on the first section of this article. This function will return one o multiple results in a JSON.

2) for each  item in property_list
Now we are going over each result, and we will use some functions to get data from the properties.

3) Property_id = item.get("Related_Properties").get("id");
We are getting the property ID using the field "Related_Properties" from the Linking Module.

4) Propert_info = zoho.crm.getRecordById("Properties",Property_id);
Now that we have the property ID, we can search for that property and get all the information related to it.

5) Property_name = Propert_info.get("Name");
From line 4, we can get, for example, the property name.

6) Propery_sq = Propert_info.get("Sq_Footage");
From line 4, we can also get any other information stored in the property. In this case, we are getting the Square Footage.
// Example
property_list = zoho.crm.searchRecords("Contacts_X_Properties","(Property_Contact:equals:" + contact_id + ")");
for each  item in property_list
Property_id = item.get("Related_Properties").get("id");
Propert_info = zoho.crm.getRecordById("Properties",Property_id);
Property_name = Propert_info.get("Name");
info Property_name;
Propery_sq = Propert_info.get("Sq_Footage");
info Propery_sq;