Kaizen #125 Manipulating Multi-Select Lookup fields (MxN) using Zoho CRM APIs

Kaizen #125 Manipulating Multi-Select Lookup fields (MxN) using Zoho CRM APIs

Hello everyone!
Welcome back to another week of Kaizen. In last week's post in the Kaizen series, we discussed how subforms work in Zoho CRM and how to manipulate subform data using Zoho CRM APIs.
In this post, we will discuss how to manipulate a multi-select lookup fields using Zoho CRM APIs.

Multi-select lookup field

The Multi-Select Lookup Field enables you to establish a many-to-many relationship between two different modules in CRM. It allows you to associate multiple records with each other, from two different modules. 
These associations are stored in an individual module called "Linking Module". Consider there are two modules, Employees and Skills. The Employees module contains details regarding Zylker's workforce, and the Skills module contains details regarding various skills like Social Media Marketing and Content Marketing.
We want to associate multiple skills to an employee. So, a multi-select lookup can be created in the Employees module. When doing so, similar multi-select lookup field will be automatically created in the Skills module, along with the EmpXSkills linking module by Zoho CRM. The underlying data model is described in the below image.
The above chart shows the data model representation when you create a multi-select lookup field in a module. Here, there are two lookup fields—one pointing to the Employees module and the other pointing to the Skills module.
In the linking module, two lookup fields (lookup fields with api names - Employees and Skills) will be created. The lookup fields, one pointing to Employees and the other pointing to Skills from the linking module, establish a connection between the linking module and its associated module.

How to associate an employee's skills while creating an Employee record through the Insert Records API

API names you need before invoking the API
  • The API name of the multi-select lookup field in the modules you want to insert data.
  • API names of the lookup fields in the linking module. Eg: here the API Name of the linking module is "EmpXSkills" and the corresponding lookup field api names are "Employees" & "Skills". You can use the Fields Metadata API for Employees and Skills to get these details.
Step 1
Know the API name of the multi-select lookup field in the module (In our case, Skills is the multi-select lookup field in the Employees module)

To know the API names of the multi-select lookup fields, make a GET - Fields Metadata API call. Among all the Employee's fields, multi-select lookup field can be identified by the json key data_type with the value multiselectlookup. The corresponding connected module can be found from the json connected_module. Below is the API call & response for such a multi-select lookup field.

Request URL : {api-domain}/crm/v6/settings/fields?module=Employees
Request Method: GET

Sample Response: 

The above highlighted keys are the details of the Multi select lookup field. The corresponding keys are explained below:

"multiselectlookup": {
                "display_label": "Skills",   //Display label of the MxN field in the Employees module
                "linking_module": {
                    "api_name": "EmpXSkills", //API name of the linking module
                    "id": "5725767000002166520"
                ...
                "lookup_apiname": "Employees", //API name of the Employee lookup field in the linking module
                "connected_module": {
                    "api_name": "Skills", //API name of the connected module
                    "id": "5725767000002165263"
                },
                "api_name": "Skills_In_Related_List", //API of the related list of the connected module Skills in the Employees module.
                "connectedfield_apiname": "Employees", //API Name of the multi-select lookup field in the connected module (Skills)
               "connectedlookup_apiname": "Skills", //API name of the Skills module lookup field in the linking module.
                "id": "5725767000002166655" //Related List ID
            },
                ...

Step 2
Using the api_name of the linking module, make a GET Fields metadata API call to get the list of fields (along with their api_name) present in it. It lists all fields of the linking module in the response. 
Sample Request and Response

Search for the "data_type": "lookup" in the response. The lookup fields represent the connected modules in association with the linking module.
For example, in our case, the response will have two lookup fields. One of the lookup fields (with api name Employees) points to the Employees module, and the other one (with api name Skills) points to the Skills module

Step 3
Associate records via the Multi-select lookup field using the Insert Records API

To associate records via the MxN field, you need to know the IDs of the records in the Skills module. Here is the input body to insert the skills in the Employee module with the multi-select lookup field Skills
Here is the input body to insert a new Employee record and associate a Skills record to it using the MxN field.

Request URL: {{api-domain}}/crm/v6/Employees
Request Method: POST
Sample Input:
{
    "data": [
        {
            "Name": "Patricia",
            "Email": "patricia@mail.com",
            "Position": "Marketing Specialist",
            "Year_of_Experience": 5,
            "Skills": [ //API name of the multi-select lookup field in Employee module
                {
                    "Skills": { //API Name of the lookup field pointing to the Skills module in the linking module
                        "name": "Marketing",
                        "id": "5725767000002149427" //Record ID in the Skills module 
                    }
                },
                {
                    "Skills": {
                        "name": "Social Media Marketing",
                        "id": "5725767000002149476" 
                    }
                }
            ]
        }
    ]
}



How to disassociate an employee & skills relation while updating an Employee record through the Update Records API 

Request URL: {{api-domain}}/crm/v6/Employees
Request Method: PUT

Sample Input:

{
    "data": [
        {
            "id": "7890710000097291",
            "Name": "Patricia",
            "Email": "patricia@mail.com",
            "Position": "Marketing Specialist",
            "Year_of_Experience": 5,
            "Skills": [
                {
                    "_delete": null, //This association in the linking module will be deleted
                    "id": "5725767000008126002" //Record created in the linking module
                }
            ]
        }
    ]
}

Sending _delete:null will cause delinking of the association.

How to associate an employee's skills via "Linking Module"

You can associate the relationship between Employees and Skills module by creating records in the Linking module (EmpXSkills). Use the API names for the corresponding lookup fields, Employee (API Name: Employees) and Skills (API Name: Skills) in the input body.

Request URL: {{api-domain}}/crm/v6/EmpXSkills
Request Method: POST

Sample Input
{
   "data": [
        {
            "Name": "Patricia",
            "Employees": { 
                "id": "5725767000002161001" //unique record ID in the Employees module. GET your ID here
            },
             "Skills": { 
                "id": "5725767000002149476" //unique record ID in the Skills module. GET your ID here
            }
        }
    ]
}


Sample Response


The id in the above response is the Primary Key ID of an Employee-Skill association record in the linking module. This ID can later be used to do specific operations like association update or deletion via API.

How to disassociate an employee & skills relationship via "Linking Module"
Use the Delete Records API to delete the record which corresponds to the specific relation between Employee and Skills module in the EmpXSkills module. You can get the record ID for the specific association using the Get Records API for the linking module. 
Use the Delete Record API to delete the specific record, thereby deleting the specific association between the Employee and Skills record. Please note that only the association is removed, and not the individual records. 
Sample Request and Response



When to use create/update operation in Employees/EmpXSkills module?

Use "Employees" module: When you want to create/update records in the Employees module, and associate the record with a Skills record in a single API call.
Use "EmpXSkills" module: When you want to associate/disassociate the relationship between existing Employees and Skills records. 

Retrieve data via COQL API and Bulk Read API

There may be situations where you need to fetch records based upon certain conditions.
For example, Zylker's HR team wants to retrieve the list of employees having more than 4 years of experience and are experts in Social media marketing. In this case, they can use Zoho CRM's COQL API or Bulk Read API. Let's see how to achieve this.

Retrieving MxN data via COQL API

We know that both the Employees and Skills modules' association data is maintained in the linking module. In order to retrieve data from the linking module, query using the API name of the lookup fields in the linking module.

Request URL: {{api-domain}}/crm/v6/coql
Request Method: POST

Sample Input:

{
    "select_query" : "select Employees.Name as employee_name, Employees.Year_of_Experience as employee_experience, Skills.Name as skill_name from EmpXSkills where Employees.Year_of_Experience > 4 and Skills.Name like '%Social%'"
}


From the SQL perspective, above COQL can be interpreted as
select emp.Name as employee_name, emp.Year_of_Experience as employee_experience, skill.Name as skill_name from EmpXSkills left join Employees as emp on EmpXSkills.Employees = emp.id left join Skills as ski on EmpXSkills.Skills = ski.id where emp.Year_of_Experience > 4 and ski.Name like '%Social%'

Sample Response


Retrieving MxN data via Bulk Read API

Bulk Read API allows you to fetch a large set of data i.e., you can fetch a maximum of 200,000 records in a single API call. 
To export linking module records, use its API name.

Request Method: POST
Sample input to export linking module's records:
{
    "callback": {
        "method": "post"
    },
    "query": {
        "module": {
            "api_name": "EmpXSkills" //API name of the linking module
        },
        "file_type": "csv"
    }
}

Export linking module records that meet the specified criteria
To export linking module's records based on the given criteria above (similar to the COQL API).
{
    "callback": {
        "method": "post"
    },
    "query": {
        "module": {
            "api_name": "EmpXSkills"
        },
        "fields": [
            "Employees.Name",
            "Employees.Year_of_Experience",
            "Skills.Name"
        ],
        "criteria": {
            "group": [
                {
                    "field": {
                        "api_name": "Employees.Year_of_Experience" 
                    },
                    "comparator": "greater_than",
                    "value": "4"
                },
                {
                    "field": {
                        "api_name": "Skills.Name"
                    },
                    "comparator": "contains",
                    "value": "Social"
                }
            ],
            "group_operator": "AND"
        }
    }
}


As the API is an asynchronous API, the response will not be available instantly; the bulk read job is scheduled, and the status can be checked. Once the job is completed, you will be notified in the callback URL. The records are available in a downloadable CSV file or ICS file (for events). See the Bulk Read API document to know how to view the status of the scheduled job and download the file, along with more sample requests and responses.

We trust that this post meets your needs and is helpful. Let us know your thoughts in the comment section or reach out to us at support@zohocrm.com
Stay tuned for more insights in our upcoming Kaizen posts!

------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
Cheers!



    • Recent Topics

    • Join our live webinar: Explore the WorkDrive TrueSync application!

      Hello everyone, We are thrilled to invite you to a live webinar focused on mastering the WorkDrive TrueSync application. Discover how to seamlessly sync your content between the cloud and your computer, ensuring smooth and efficient file management. Our
    • Bug tracking

      Hi, does anyone know how to track errors during picking or packing? This way I can keep track and see how to improve and prevent errors in this area.
    • Can the Product Image on the Quote Template be enlarged

      Hello, I am editing the Quote Template and added ${Products.Product Image} to the line item and the image comes up but it is very tiny. Is there anyway that you can resize this to be larger? Any help would be great! Thanks
    • Zoho Creator customer portal limitation | Zoho One

      I'm asking you all for any feedback as to the logic or reasoning behind drastically limiting portal users when Zoho already meters based on number of records. I'm a single-seat, Zoho One Enterprise license holder. If my portal users are going to add records, wouldn't that increase revenue for Zoho as that is how Creator is monetized? Why limit my customer portal to only THREE external users when more users would equate to more records being entered into the database?!? (See help ticket reply below.)
    • Script Editor not an option

      I am trying to apply a script to a sheet and Script Editor is not an option. I don't want to go outside Sheets to do this (like Creator) if it can be done inside Sheets.
    • Send Automated WhatsApp Messages and Leverage the Improved WhatsApp Templates

      Greetings, I hope all of you are doing well. We're excited to announce a major upgrade to Bigin's WhatsApp integration that brings more flexibility, interactivity, and automation to your customer messaging. WhatsApp message automation You can now use
    • Envio de mails

      Hola! No puedo enviar mails pero si recibirlos. No se como solucionarlo! Mi dominio es chidobebes.com.ar
    • ERROR CODE :554 - Your access to this mail system has been rejected due to poor reputation of a domain used in message transfer

      In my email configuration: The domain's MX Records are pointed to Zoho The domain's SPF Records have been pointed out successfully DKIM is enabled. DMARC Record is pointed for the domain. The domain name is digioorja.in. Still facing the issue of Error:
    • This Operation has been restricted. Please contact support-as@zohocorp.com for further details

      l tried to verify my domain (casalimpaeperfumada.com.br) and its shows this error: This Operation has been restricted. Please contact support-as@zohocorp.com for further details.
    • SLOW EMAILS

      Is there an issue with the Zoho server? For two days now I've been having issues with very long buffering. Please advise. Thank you.
    • POP3 authentication error - SOLVED

      Just in case others are as forgetful as me ... As Zoho has changed the POP server for personal and free organisational users, I needed to change the POP server on my email client. This failed persistently but eventually I remembered that I had chosen
    • Solution to Import PST File into Office 365.

      MailsDaddy OST to Office 365 Migration Tool is an outstanding solution to recover OST files and migrate them into Office 365 without any hassle. Using this software users can multiple OST files into Office 365 with complete data security. It offers users
    • Add Zoho One Groups/Departments to Shared Mailbox Access

      Hi, I hope you're doing well. Currently, in Zoho Mail, I can manually add specific users or the entire organization to a shared mailbox. However, there is no option to add Zoho One groups or departments. Feature Request: We would like the ability to assign
    • Allow Filters with Only Special Characters in Zoho Mail

      Hi Zoho Mail Team, I hope you're doing well. We have noticed that currently, Zoho Mail does not allow creating filter criteria using only special characters, such as = or #. However, there are scenarios where such a filter is necessary. For example: Filtering
    • How to save email as PDF?

      I saw 2 previous threads about this. One is from 14 years ago. The other was closed as "answered" a year ago but the feature was never implemented: https://help.zoho.com/portal/en/community/topic/how-to-download-save-emails-as-pdf Is the "save as PDF"
    • Flexible plans

      Hi, I have a Workplace Standard subscription. On Zoho's website, it mentions that with the annual plan it's possible to have multiple plans under the same organization—for example, Workplace Standard and Mail Lite. However, I can’t find a way to do this
    • Weekly Tips : Teamwork made easy with Multiple Assignees

      Let's say you are working on a big project where different parts of a single task need attention from several people at the same time—like reviewing a proposal that requires input from sales, legal, and finance teams. Instead of sending separate reminders
    • Cannot give public access to Html Snippet in Zoho Creator Page

      Hi, I created a form in Zoho Creator and published it. The permalink works but I want to override the css of the form. (style based URL parameters is not good enough) So I created a page and added an Html snippet. I can now override the css, which is
    • Weekly Tips : Customize your Compose for a smoother workflow

      You are someone who sends a lot of emails, but half the sections in the composer just get in your way — like fields you never use or sections that clutter the space. You find yourself always hunting for the same few formatting tools, and the layout just
    • Unable to confirm Super Admin assignment — confirmation button not working

      I’m trying to change the roles within my organization. I am currently a super admin and would like to add another user as a super admin. When I attempt to confirm the action, a screen appears asking for my password to verify my identity. However, when
    • Installing EMAIL Setup in New Domain

      Respected Support team, I'm facing an issue with cloudflare in Pakistan, I want to setup Zoho Mail Setup but I Don't know how to enable Zoho mail setup without cloudflare. My Website https://stumbleguyzzapk.com/, https://fakservices.com/ is using CF,
    • Will I Get a Refund If I Downgrade Zoho Mail?

      Hello, We upgraded an email account for our new employee. However, the employee left after one month, and now I've reduced the number of Zoho Mail users from 7 to 6. Can we get a refund for the remaining portion of our annual payment?
    • Accounting on the Go Series-43:Enhancing Your Reporting Efficiency with Dashboard Filter State Retention

      Hello everyone! Welcome back to our series on Zoho Books mobile app features. Today, we will talk about a feature that yet again helps you focus on work that really matters-Dashboard Filter State Retention. Imagine you're working on your Zoho Books dashboard,
    • Zoho books/payroll tax payment

      I accidentally made a second payment to my taxes for $300 which is reflected in my bank account and therefore on Zoho books but I can not match it to any transactions because its not reflected in payroll as a tax payment. Is there a way to add an extra
    • I can't renew the Finance Plus subscription

      I tried to renew the Finance Plus subscription but it keeps reloading the same page over and over when ever I click on "Renew Subscription" button
    • Estimate vs Quote

      they are different. Quote is for 1 piece price + other charges. Estimate is for total quantity to be ordered. The gross total amount of the Estimate is the amount payable. Replacing Estimate as Quote is not understandable because they are different. In
    • Accounting on the Go Series-47: Effortless GSTIN Management- Auto Populate TaxPayer Details in Zoho Books Mobile App

      Hello everyone, Welcome back! Today, we're focusing on a feature specifically designed for our Indian users in the Zoho Books-Indian edition, particularly those who deal with GST compliance regularly. We understand the importance of accurate and efficient
    • Accounting on the Go Series-48: Enhance Accuracy with Custom Work Week Start Days in Zoho Books iOS app

      Hello everyone, Welcome back! We’re here with another feature spotlight that might seem small but can have a big impact on your daily routine: setting the first day of the work week in the Zoho Books iOS app. Imagine this: You’re a business owner who
    • Time to Get Paid Report in ZBooks

      Hello, One of our customers who has 25 different companies around the world gets 60 days to make payments. Unfortunately, the subject report does not report an average time to get paid (in days) or the ability to look at a custom period of time. Currently
    • How to prepare a balance sheet for a company that has no operations yet?

      .
    • Project Billing Method from Zoho People

      Normaly our customers use Zoho Projects to manage projects and timesheet that are being charge to the customer. Using the integration from Zoho Project we can have projects base on different billing method. For example most of our customer use Hourly
    • Zoho Books-Accounting on the Go Series!

      Dear users, Continuing in the spirit of our 'Function Fridays' series, where we've been sharing custom function scripts to automate your back office operations, we're thrilled to introduce our latest initiative – the 'Zoho Books-Accounting on the Go Series'.
    • Zoho Books | Product updates | July 2025

      Hello users, We’ve rolled out new features and enhancements in Zoho Books. From plan-based trials to the option to mark PDF templates as inactive, explore the updates designed to enhance your bookkeeping experience. Introducing Plan Based Trials in Zoho
    • Zoho Books | Product updates | August 2025

      Hello users, We’ve rolled out new features and enhancements in Zoho Books. From the right sidebar where you can manage all your widgets, to integrating Zoho Payments feeds in Zoho Books, explore the updates designed to enhance your bookkeeping experience.
    • Apply Payment Received Amount Zoho Books Invoice

      Hello team here is the sample code How can apply the payment received record over a unpaid zoho books invoice. //......................... paymentID = customer_payment.get("payment_id"); organizationID = organization.get("organization_id"); paymentmaplist
    • Update or Upsert Records Using Unique Custom Fields

      Hello customers, We've enhanced the process of updating records via API. You can now: Update records using unique custom fields Upsert records using unique custom fields Note: Both the features are available in the Zoho Books and Zoho Inventory apps.
    • [Webinar] Understanding the New Invoice Management Systems

      Join industry expert CA Pritam Mahure as he discusses the importance of the new Invoice Management System (IMS) and its impact on taxpayers. Topics Covered: - Concept of IMS and pre-requisites - Applicability and Restrictions on Invoices/Records for IMS
    • Accounting on the Go Series-51: Effortless Transactions: Create and Manage Directly from Uploaded Documents

      Hello everyone, We’re back with another useful feature that makes working with Zoho Books even easier! This time, we’re simplifying the process of creating transactions directly from uploaded documents. Imagine you’re out meeting clients, and you receive
    • [WEBINAR] Effortless migration to the VAT-ready South Africa edition of Zoho Books

      Hello there, If you are one of our early users from South Africa using the older edition of Zoho Books, this webinar is for you! We have now launched a new South Africa edition with VAT support, to which you can migrate your existing data. Join this session,
    • Accounting on the Go Series-52: Capture Receipts on the Go, Right from Your Lock Screen.

      Hello everyone, We’re excited to introduce a feature that will make your life so much easier—especially for those constantly on the move! With iOS 18, Zoho Books now allows you to capture receipts directly from your lock screen using Locked Camera Capture.
    • Next Page