Hello everyone!
In this post, we will discuss how to manipulate the Subform data using Zoho CRM APIs.
A Subform is a data section embedded in the primary form to collect details related to the parent record. It helps in maintaining multiple records under a single parent record.
Using subform, you can create a parent-child relationship between modules, where the parent module represents the primary data and the child module contains the related data.
Data Model Representation
The above diagram shows the data model representation when you create a subform in a module. Consider adding a subform field named Project Details in the Leads module (parent module). Zoho CRM will automatically create
a separate module for the subform field with the specified subform field name - Project Details. Each record within the subform module can have multiple fields, in addition to the system-defined
Parent_Id lookup field, establishing a connection between the
parent (Leads module) and
child (subform module) modules. Through this linking process, one can easily identify which subform record corresponds to which specific lead record.
Use Case
Consider Zylker Consulting organization using Zoho CRM to maintain their leads and their projects. Zylker uses the Project Details subform in the Leads module to collect project-specific information collected from their Leads.
The Project Details subform includes fields such as Project Title,Type, Budget, and Status, in addition to the Parent_Id lookup field.
Now, the Zylker's sales team needs to retrieve all the details of the projects from the Leads module for further project analysis, expected budgets, and status. Let's see how to manipulate these data in CRM using Zoho CRM APIs.
The APIs used in this post
API
| Methods |
Subforms API | GET, POST, UPDATE |
Records API | POST, UPDATE, DELETE |
Search API | GET |
COQL API | POST |
Bulk Read API | POST, GET |
How to retrieve subform records using the Zoho CRM APIs?
To retrieve subform records from the subform module, specify the subform module's API name to access their records or fields.
Step - 1
To know the API names of the subform fields in a module, make a GET - Fields Metadata API call. Among all the Leads' fields, subform field can be identified by the json key data_type with the value subform. Corresponding subform module can be found from the json associated_module. Below is the API call & response for such a subform field.
Request URL :
{api-domain}/crm/v6/settings/fields/{subform_field_id}?module=Leads
Request Method: GET
Sample Response:
Step - 2
Using the api_name of the subform module, make a GET Fields metadata API call to get the list of fields (along with their api_name) in the subform. One of the fields of the subform module will be Parent_Id with the data_type as lookup, pointing to the parent module (here it is Leads).
Request URL
Request Method: GET
Sample Response:
Now you know how to get the API name of the subform and its corresponding fields.
Step - 3
Sample Request and Response to retrieve subform records
The below request will retrieve all the subform records in the Leads module. The linking of subform record to the Lead's module will be available in the Parent_Id field, which is highlighted. The id key inside the Parent_Id json object is the id of the Leads records.

How to add data to the subforms?
To add records to the subform, you need the API name of the subform and its corresponding field API names.
Request URL:
Request Method: POST
Sample Input
{ "data": [ { "Last_Name": "Patricia", "Company": "Info Technology", "Project_Details": //API name of the subform [ { "Project_Name": "Mobile App Development for Productivity", "Project_Type": "Mobile App Development", "Expected_Budget": 50000, "Status": "Negotiation in Process" }, //API names of the subform fields { "Project_Name": "Big Data Infrastructure Implementation", "Project_Type": "Infrastructure Upgrade", "Expected_Budget": 30000, "Status": "Proposal Submitted" }, { "Project_Name": "Big Data Infrastructure Implementation", "Project_Type": "Infrastructure Upgrade", "Expected_Budget": 30000, "Status": "Proposal Submitted" } ] } ] }
|
The above highlighted syntax is used for adding data to the subform records.
Sample Response:
Kaizen
#33 - Subforms API explains in detail how to Fetch, Update, and Delete the subform data with sample requests, inputs, and responses.
Retrieve Subform Data via Search API and COQL API
There may be situations where you need to fetch records based upon certain conditions.
Criteria :
The sales team wants to retrieve the subform records whose budget is
greater than or equal to $40000. In this case, we will use Zoho CRM's
Search API and
COQL API. Let's see how to achieve this.
Search API
To retrieve the records that match your search criteria, retrieve subform data using its corresponding module API name. Note that using Search API, you can fetch data quickly from a single module.
Request URL:
Request Method: GET
Sample Response :
The above response shows all records that meet the specified criteria.How to retrieve subform records from a particular parent record?
To retrieve subforms records in a particular lead record that meet the above criteria, follow the below sample request.
Sample Request URL:
Sample Response:
Retrieving Subforms Data via COQL API
We know that the subform is maintained in a separate module. So, retrieve subform data by querying the subform module's API name and it's parent module via the Parent_Id lookup field.
Request URL:
Request Method : POST
Sample Input:
{ "select_query" : "select Expected_Budget from Project_Details where ((Expected_Budget >=40000) and (Parent_Id = 5725767000002105043))" } |
Sample Response:
Using a Parent_Id (lookup field pointing to Leads module) in the COQL criteria automatically adds a left join to the child module (Project_Details). With that join, criteria can be applied to the fields of the parent module also. Below example illustrates that we want to fetch the Expected_Budget field of the Project_Details module where the Expected_Budget is greater than or equal to 40000 for the corresponding Leads with Annual Revenue greater than 1000000.
{ "select_query" : "select Expected_Budget from Project_Details where ((Expected_Budget >=40000) and (Parent_Id.Annual_Revenue > 100000 ))" } |
From the SQL perspective, above COQL can be interpreted as
select pd.Expected_Budget from Project_Details as pd left join Leads as l on pd.Parent_Id=l.id where pd.Expected_Budget>=40000 and l.Annual_Revenue > 1000000 |
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 subform records in the Leads module in CSV file format, use the subform's API name.
Request URL:
Request Method: POST
Sample input to export subform records:
{ "callback": { "method": "post" }, "query": { "module": { "api_name": "Project_Details" //API name of the Subform module }, "file_type": "csv" } }
|
Export subform records that meet the specified criteria
To export subform records based on the given criteria above (similar to the criteria for Search and COQL APIs).
Sample Input:
{ . . . "query": { "module": { "api_name": "Project_Details" }, "fields": [ "Project_Name", "Project_Type", "Expected_Budget", "Status" ], "criteria": { "field": { "api_name": "Expected_Budget" }, "comparator": "greater_equal", "value": "40000" //Retrieving subform records with an expected budget greater than or equal to $40,000 } } } |
Export subform records that meet the specified criteria for the particular parent record
To export the subform records of a particular parent record in the Leads module. Check the below sample request.
Sample Input:
{ . . . "query": { "module": { "api_name": "Project_Details" }, "fields": [ "Project_Name", "Project_Type", "Expected_Budget", "Status" ], "criteria": { "group": [ { "field": { "api_name": "Expected_Budget" }, "comparator": "greater_than", "value": "39999" }, { "field": { "api_name": "Parent_Id" }, "comparator": "equal", "value": "5725767000002105043" } ], "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, it'll be notified in the callback URL. The records are available in a downloadable CSV file or ICS file (for events). You can export subform records in a module using the subform module API name. See Kaizen #12 Bulk Read API to know how to view the status of the scheduled job and download the file, along with more sample requests and responses.Frequently Asked Questions
Q. Is the API name of the subform case-sensitive? Also, how can I view the API name of a subform field in the web UI?
Yes, the API name of a subform is case-sensitive. To know the API name of a subform module (e.g. Project Details) Please go to Setup -> Developer Hub -> APIs -> CRM API -> API names -> Click on the parent module where the subform was created (e.g. Leads) and scroll down there you can view the subform field's API name.
Q. I changed the order of subform records and made a GET - Records API call. The system listed the records in the same order as displayed in the UI, rather than the order of their creation. Is this the system design?
When you make a
GET - Records API call for a module, it lists the subform records ordered in the UI. Note that you can re-order the subform records. So, when you retrieve those records via the API, they will be listed in the same order as they are arranged in the UI.
Q. Can we change a subform field's API name via API?
You can change the API name of the subform field only through the UI. Go to Setup -> Developer Hub -> APIs -> CRM API -> API names -> Click on the parent module where the subform was created (e.g. Leads) and go to the Field Label section. There you can view the subform field name and edit the API by clicking on the Edit option.
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!
Additional Reading:
Kaizen Posts:
Recent Topics
Approval Process Comments
Is it possible to view the comments entered during the approval or rejection of a record in the approval process? If not, is there a way to require a field to be completed upon approval or rejection?
Login for test case
Had a few questions regarding authentication test cases and couldn't find an answer in the the docs. 1. If an app like Zoho Creator requires authentication before providing access, do I need to create a login function and add it to each test case? 2.
Zoho / Outlook Calendar sync
The current Marketplace -> Microsoft -> Meetings integration needs 2 changes. 1. The current language for the Two-Way sync option should be changed. It currently states, "Sync both your Zoho CRM Calendar and Office 365 Calendar meetings with each other."
Customer members area
Does FSM support a customer members area? If not what do you propose we use if we want the data used in FSM for customers to give them an area / login to see past orders, create new orders and general announcements.
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'.
Desktop app doesn't support notecards created on Android
Hi, Does anybody have same problem? Some of last notecards created on Android app (v. 6.6) doesn't show in desktop app (v. 3.5.5). I see these note cards but whith they appear with exclamation mark in yellow triangle (see screenshot) and when I try to
Notes created in mobile can no longer be accessed in desktop
Working with a 2013 Mac running OS 10.14.6; Desktop Notebook version 4.5.3. Using Motorola Moto G Power 5G - 2024; Android app version 6.7 I have been using Notebook for some years. Starting several weeks ago, the notes newly created ion the phone can
Function #49: Manage varying installment payments using Zoho Books
. Hello everyone, and welcome back to our series! Last week, we discussed automating the collection of fixed installment payments in Zoho Books. But what if your payment structure involves charging varying percentages of the invoice total as installments?
Zoho Writer - Option to Export as .zdoc format
I've noticed that it's not possible to export a Zoho Writer Document in the .zdoc format. Isn't zdoc, Zoho Writer's own format? My use case is that I sometimes need to create quite complex documents with floating elements, which sometimes need to become
Is it possible for contacts to "Re-enter" a workflow in Zoho Campaign?
We are currently working on a way to automatically add users to from one list to other lists based on specific criteria, but can't seem to find a native way of doing this so we are trying to use Workflows to do this. So, for example, if a user's status is set to "Active," then they should be added to the list "Active Users." If the same user's status is then set to "Paused," they should be added to the list "Paused Users" and removed from the list "Active Users." This works fine for the first go
Bulk upload images and specifications to products
Hi, Many users have asked this over the years and I am also asking the same. Is there any way in which we can bulk upload product (variant) images and product specifications. The current way to upload/select image for every variant is too cumbersome.
Out of Office for Just One of My Alias Email
Can I set up the Out of Office Reply for Just One of my Alias Email Addresses?
Can I map multiple Surveys into the CRM using the same fields?
Hello, We are a healthcare practice that offers two distinct services (Nutrition and Primary Care). We use Zoho Survey for our lead generation form (Get Started Survey), which allows people to express interest in one of the two services and even allows
Dealing with API responses where integers have more than 16 digits
Hi there How do I deal with an api response contaning an int or float with more than 16 digits (before any decimal places for a float). I constantly receive the response "Unable to cast the 'BigInteger' value into a 'BIGINT' value because the input is
Can't change form's original name in URL
Hi all, I have been duplicating + editing forms for jobs regarding the same department to maintain formatting + styling. The issue I've not run into is because I've duplicated it from an existing form, the URL doesn't seem to want to update with the new
Need Inactive accounts to be visible in Reports in Zoho Books
I N=need Inactive accounts to be visible in Reports in Zoho Books to do recons of the accounts but when i see the same they are not visible in the Accountant - Account Transactions report
unblock e-mail
please unblock my e-mails info@meatnews.gr and myrtokaterini@meatnews.gr
Add Zoho Mail for users who do not need Zoho One
We have licenses for ZOho One for teams that need to use the suite of products that Zoho One offers. We have 8 more people who only need email access and we would like to add just a Zoho Mail. They do not need the Zoho One license. We are currently
ZML vs HTML Snippet - which is better?
Are there certain use cases where one is better than the other?
Auto CheckOut Based On Shift.
This Deluge script runs on a scheduled basis to automatically set the 'Actual_Check_Out' time for employees who haven't manually checked out. If the current time is past their scheduled 'Shift_End_Time', the script updates the check-out time to match
How to remove some users in zoho accounts
How to remove some users in Zoho accounts.
Infinite loop of account verification
Hi I can't do anything on my zoho account. I always get this message Hi Sheriffo Ceesay As a security measure, you need to link your phone number with this account and verify it to proceed further. When ever I supply the details, it displays that the number is associated with another account. I don't have any other account on zoho so this is really annoying.
Load PO_Date field (Purchase Order) with current date in Deluge
Hi, I'm not a full time developer, just helping to customize our CRM, in the small company I work for. There must be something wrong with me, because I can't do something so simple as complete a field with the current date in a function using Deluge.
Zoho CRM in Microsoft Power Automate Custom Connector
Hi everyone, I’m building a Power Automate flow that integrates Microsoft Bookings with Zoho CRM. The goal is to automatically create a meeting (event) in Zoho CRM whenever a new appointment is booked via Microsoft Bookings. To achieve this, I created
Spell check sucks
Come on guys, it's 2024 and your spell check is completely retarded. You gotta fix it.
How to include total km for multiple trips in expense report.
Whenever I create a mileage report it only shows the total dollar amount to be reimbursed. The mileage for each individual trip is included but I also need to see the total distance for all trips in a report? How do I do this?
Outgoing blocked: Unusual activity detected.
I just made payment for my Zohomail Today and have been debited so i will like to be Unblocked because this is what it says (Outgoing blocked: Unusual activity detected) Thank you i await your swift responses
Zoho One Login Issue - Unable to receive OTP
Hi Support Team, I am experiencing a unique login issue with Zoho One. I am attempting to log in from India using Zoho Login credentials provided by a USA-based client. Their Zoho account is hosted on a US data center. After entering the username and
Question Regarding Managing Sale Items in Zoho Books
Good day, I was wondering about something. Right now, Zoho Books doesn’t seem to have a way to flag certain items as being on sale. For example, if I want a list of specific items to be on sale from October 1 to October 12, the user would have to export
In the Zoho Creator Customer Payment form i Have customer field on select of the field Data want to fetch from the invoice from based on the customer name In the Customer Payment form i Have subf
In the Zoho Creator Customer Payment form i Have customer field on select of the field Data want to fetch from the invoice from based on the customer name In the Customer Payment form i Have subform update Invoice , there i have date field,Invoice number
Problem of Import Client Users From CRM and or Expense
I am premium plan user on Projects. I have about 500 customers on Expense and CRM that integrated with each other. According to at below link, I am trying to import clients from CRM, system not allowed to select any customer. If I import from Expense,
Unable to see free plan option
Hello Zoho Support Team, I hope you are doing well. I am trying to sign up for Zoho Mail, but I am unable to see the option for the free plan. Could you please guide me on how I can access or activate the free plan? Thank you for your assistance.
unblock my zoho mail account. outlines@zoho.com
please unblock my zoho mail account, outlines@zoho.com
domain not verified error
Hi when i try to upload a video from zoho creator widget to zoho work drive iam getting domain not verified error.I don't know what to do .In zoho api console this is my home page url https://creatorapp.zoho.com/ and this is my redirect url:www.google.com.Iam
equest to Disassociate Bigin from Zoho One and Migrate to Standalone (Upgrade to Bigin Premier – 3 Seats, Annual)
Dear Zoho One Support Team, I’m writing to request your assistance to disassociate (remove) the Bigin application from our Zoho One organization while preserving all existing Bigin data. After the disconnection is successfully completed, we intend to
SMTP email sending problem
Hello, I've sent emails before, but you haven't responded. Please respond. My work is being disrupted. I can't send emails via SMTP. Initially, there were no problems, but now I'm constantly receiving 550 bounce errors. I can't use the service I paid
billing
hi, I am being billed $12/year, and I can't remember why. My User ID is 691273115 Thanks for your help, --Kitty Pearl
How to add receipts
How to add receipts
Unable to enable tax checkboxes
Hi Zoho Commerce Support, I'm writing to report an issue I'm having with the tax settings in my Zoho Commerce store. I've created several tax rates under Settings > Taxes, but all of them appear with the checkbox disabled. When I try to enable a checkbox,
Zoho Commerce - Enable Company Name and Tax Number collection for B2B orders in Global Edition
Please enable Company Name and Tax Details option on checkout settings in Zoho Commerce Global Edition. It is still important to collect Company Name and Tax Number for B2B sales in many countries. My business is based in Ireland (in the EU) and I have
Next Page