Kaizen #31 - Subforms #API

Kaizen #31 - Subforms #API

Hello everyone!
Welcome back to another post in the Kaizen series.
In this post, we will discuss the Subform APIs.

What is a Subform?
A subform is a secondary form or a table that enables you to include multiple line items into a primary form. Every line item is a subform record.
Your CRM data are often inter-dependent. Often, you may have the necessity to associate multiple items to a single record. In the technical lingo, we call these "line items".
Consider we have a Students module to store student records. Apart from the data like name, age, date of birth, email ID, courses opted for etc, we may want to have information such as the languages a student knows and the proficiency level in that language. So, Languages can be a subform in the Students module, and Language and Proficiency can be the two fields in that subform.
Therefore, every row in this subform that holds the language and the proficiency is a subform record or a line item.

Here is how the subform looks in a record in the Students module.


To know more about Subforms, refer to
Building Subforms.

Note
The Subform API is available only in the Enterprise and Ultimate editions of Zoho CRM.

Let us see how to insert, update, and delete these subform records through the APIs.

Subform APIs
  1. Insert Subform Records
  2. Update Subform Records
  3. Get a Subform
  4. Delete Subform Records

1. Insert Subform Records

You must use the Insert Subform Records API to insert records to a subform while inserting a record to a module.

Details Required: 
      a. API Name of the subform.
      b. API name of the subform fields.

a. API name of the subform
  1. Make a Get Modules API call. The response displays the details of all the available modules.
  2. Search for the module in which you have created the subform. In our case, it is Students.
  3. Look for the value of the key "generated_type" as "subform". 
  4. The value of the key "api_name" gives the API name of the subform. In our case, it is Languages.

b. API name of the subform fields
  1. Make a Get Fields Metadata API call to the subform module (crm/v2/settings/fields?module=Languages).
  2. Search for the field label. The value of the "api_name" key for the fields in the subform are the API names. Here, they are Proficiency and Language.
  3. Note down the "json_type" that represents the type of value the subform fields accept. Here, they are pick lists that accept string values.

To insert subform records:
Request URL: {{api-domain}}/crm/v2/Students
Request method: POST

Sample Input

{
    "data": [
        {
            "Name":"Allan John",
            "Languages1": [
                {
                    "Proficiency": "Native",
                    "Language": "English"
                },
                {
                    "Proficiency": "Professional",
                    "Language": "French"
                }
            ]
        }
    ]
}

Response:


Note
  • A module can have a maximum of two subforms for all editions except Ultimate. The Ultimate edition can have a maximum of five subforms.
  • Every module can have a maximum of 200 subform records with each subform having a maximum of 100 records.
  • A maximum of five aggregate custom fields are available for a subform.
Possible Errors
The "details" key in the response gives you an idea of where the error occurred. This key contains the API name of the field that has incorrect input and other necessary information in other keys.


HTTP Status and Error Code
"details" key
Reason for error
Handling
400 - INVALID_DATA
"details" : {
"api_name":"sub_form_api_name",
"expected_data_type":"jsonarray"
}
Invalid input for subform.

Construct proper subform data and send it in the request body.
400 - INVALID_DATA
"details" : {
"expected_data_type":"data_type",
 "api_name" : "name_of_field",
 "index" : "subform_array_index",
"parent_api_name":"subform_api_name"
}
You have input Invalid data type for the field.
Use parent_api_name, index, and api_name to identify the invalid field and use expected_data_type to construct a proper value.
400 - INVALID_DATA
"details" : {
 "api_name" : "subform_api_name",
 "info" : "Maximum of 100 records allowed"
}
A subform can only have a maximum of 100 records.
Do not associate further records to the mentioned subform.

2. Update Subform Records

Now that we have created a subform, every subform row is a record with a unique ID. 
Use the Update Subform Records API to update the subform record(s).

Let us now update the subform entries we just added to the Languages subform in the Students module.
The changes we are making are:
      a. Adding a subform entry for the Language "Spanish" with Proficiency as "Professional".
      b. Updating the Proficiency of the Language "French" to "Native".

Details required:
Record IDs of the subform records that you want to update. Make a Get Subform Data API call to the Student record you want to update the subform in.



The request to update the subform is
Request URL: {{api-domain}}/crm/v2/Students/3652397000002125005
Request method: PUT

Sample Input

{
    "data": [
        {
            "Languages": [
                {
                    "Proficiency": "Professional", //new subfrom record
                    "Language": "Spanish"
                },
                {
                    "id":"3652397000002125020",  //ID of the subform record that you want to update
                    "Proficiency": "Native",
                    "Language": "French"
                },
                {
                   "id":"3652397000002125019" //ID of the subform record that does not need any change
                }
            ]
        }
    ]
}

Response:



Note
  • You must specify the record IDs of the subform records you want to update and also the ones you do not want to update.
  • If you do not specify their IDs, the system deletes those records from the subform.

Possible Errors

HTTP Status and Error Code
"details" key
Reason for error
Handling
400 - INVALID_DATA
"details" : {
"api_name":"sub_form_api_name",
"expected_data_type":"jsonarray"
}
Invalid input for subform.
Construct proper subform data and send it in the request body.
400 - INVALID_DATA
"details" : {
"expected_data_type":"data_type",
 "api_name" : "name_of_field",
 "index" : "subform_array_index",
"parent_api_name":"subform_api_name"
}

You have input invalid data type for the field.
Use parent_api_name, index, and api_name to identify the invalid field and use expected_data_type to construct a proper value.
202- INVALID_DATA
Message: the id given seems to be invalid
1. Either the record ID or the subform record ID is invalid, (or)
2. User does not have the permission to the mentioned record.
1. Check the record ID sent in the API request URL or in the request body (or)
2. Check the subform record ID sent in the request body.

3. Get a Subform

You can use the Get Subform Data API to fetch the details of the subform of a record.
In the response, the key Parent_Id gives the name and ID of the record that the subform record is associated to.

Request URL: {{api-domain}}/crm/v2/Languages
Request method: GET

Response:



You can also get the subform details when you fetch a record from the module the subform is created in.

Request URL: {{api-domain}}/crm/v2/Students/3652397000002125005
Request method: GET

The response is as below.



4. Delete Subform Records

Simply make an Update Subform Records API call to the record whose subform record you want to delete.
Specify only the IDs of the subform records that you want to retain. The system deletes the other subform records whose IDs you have not specified.


We hope you found this post useful. Stay tuned for more!

Write to us at support@zohocrm.com if you have any questions, or let us know in the comment section.

Cheers!













    Access your files securely from anywhere


              Zoho Developer Community




                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day


                                      • Ask the Experts



                                          Zoho Marketing Automation


                                                  Manage your brands on social media



                                                        Zoho TeamInbox Resources

                                                          Zoho DataPrep Resources



                                                            Zoho CRM Plus Resources

                                                              Zoho Books Resources


                                                                Zoho Subscriptions Resources

                                                                  Zoho Projects Resources


                                                                    Zoho Sprints Resources


                                                                      Qntrl Resources


                                                                        Zoho Creator Resources



                                                                            Zoho CRM Resources

                                                                            • CRM Community Learning Series

                                                                              CRM Community Learning Series


                                                                            • Kaizen

                                                                              Kaizen

                                                                            • Functions

                                                                              Functions

                                                                            • Meetups

                                                                              Meetups

                                                                            • Kbase

                                                                              Kbase

                                                                            • Resources

                                                                              Resources

                                                                            • Digest

                                                                              Digest

                                                                            • CRM Marketplace

                                                                              CRM Marketplace

                                                                            • MVP Corner

                                                                              MVP Corner





                                                                                Design. Discuss. Deliver.

                                                                                Create visually engaging stories with Zoho Show.

                                                                                Get Started Now


                                                                                  Zoho Show Resources


                                                                                    Zoho Writer Writer

                                                                                    Get Started. Write Away!

                                                                                    Writer is a powerful online word processor, designed for collaborative work.

                                                                                      Zoho CRM コンテンツ








                                                                                        Nederlandse Hulpbronnen


                                                                                            ご検討中の方




                                                                                                  • Recent Topics

                                                                                                  • Multi-currencies in Zoho Books

                                                                                                    I'd like to request multiple currencies in Zoho Books. I have customers paying in USD, CAD, CNY. I need to bill customers in these currencies too. I can set up a base currency, and then set up a exchange-rate table to convert these currencies.
                                                                                                  • This user is not allowed to add in Zoho. Please contact support-as@zohocorp.com for further details

                                                                                                    Hello, Just signed up to ZOHO on a friend's recommendation. Got the TXT part (verified my domain), but whenever I try to add ANY user, I get the error: This user is not allowed to add in Zoho. Please contact support-as@zohocorp.com for further details I have emailed as well and writing here as well because when I searched, I saw many people faced the same issue and instead of email, they got a faster response here. My domain is: raisingreaderspk . com Hope this can be resolved.  Thank you
                                                                                                  • Client Side Scripts for Meetings Module

                                                                                                    Will zoho please add client side scripting support to the meetings module? Our workflow requires most meeting details have a specific format to work with other software we have. So we rely on a custom function to auto fill certain things. We currently
                                                                                                  • Zoho marketing hub integration with WordPress WooCommerce

                                                                                                    Hello All,  I am a Zoho One User and we are using Zoho Marketing Hub we also have a website on Wordpress and we use Woo Commerce as our store.  im looking to find out if Zoho Marketing Hub Integrates with WooCommerce   ideally we would like to create Journeys or campaigns series based on customer behavior such as buying or already have purchased specific products. or if they go to the store but don't buy (abandon cart follow)  i saw that there is a wordpress plugin for Zoho Campaigns https://wordpress.org/plugins/zoho-campaigns/ but
                                                                                                  • Integration with Zoho CRM?

                                                                                                    Will it be possible to integrate WorkDrive with CRM similar do Zoho Docs?
                                                                                                  • Update ticket via import.

                                                                                                    Hi Zwitch team imported my tickets from freshdesk. Nice job but there is 2 pb 1st: we made mistake in agent email then ticket of this agent are unassined after zwitch import 2nd : zwitch does not take time entries. Then I got an idea. I exported from
                                                                                                  • Make function for repeating code

                                                                                                    Hi, It's me again with my questions... 😅 In my Creator app, there's code that repeats itself in several places. And repeating code necessarily means optimization. So I'm trying to create a custom function to centralize my code in a single place and call
                                                                                                  • Last activity time is acting like last modified time

                                                                                                    When i edit the description or any field in the potential, account, contact and lead, the Last Activity Time is being updated like the Modified Time. This is messing all workflows and reports and we are unable to track real last time of activities like mentioned in this KB article http://crmkbase.zoho.com/what-is-the-difference-between-record-modified-time-and-record-last-activity-time
                                                                                                  • Make collecting payments from your customers in Bigin easier with payment links

                                                                                                    Greetings, Efficient payment collection is crucial for business success. Bigin already helps your businesses manage and sell products effectively, but we can further enhance this by making payment collection easier. This integrated payment feature lets
                                                                                                  • Do "shortcuts" or symlinks exist in Workdrive?

                                                                                                    I need some kind of link or shortcut to put into folders that point back to original files or folders, is there any way in Workdrive to do this?
                                                                                                  • Line chart customization

                                                                                                    Hi, is there any way to draw multiple lines on a single line chart. Now on te x-axis im displaying dates and on the y-axis dispalying total records count. I want to display multiple lines on the same chart. The sample image is attached
                                                                                                  • Kaizen #91: Dynamic Lookup filters using Client Script

                                                                                                    Hello everyone! Welcome back to another captivating Kaizen post. In this post, we will explore the process of implementing lookup filters using Client Script. What is a dynamic lookup filter? A dynamic lookup filter is a feature that allows you to specify
                                                                                                  • Deluge Function to Update Custom Field

                                                                                                    I'm trying to get a Deluge function (which will run as part of a Schedule in Desk) that retrieves all tickets with the status "Recurring" and updates the custom field checkbox "cf_recurring" to "true". Here's what I have, which doesn't work: searchValue
                                                                                                  • How to join a meeting?

                                                                                                    One to one calls work perfectly fine within Trident. Though I see no option to initiate or join a scheduled multi-user meeting there. If a meeting is already in progress then a click on "Join Meeting" buttons takes me to the browser instead of joining
                                                                                                  • Atualização que agora me lascou!

                                                                                                    Bom dia a todos! Recentemente a Zoho lançou uma atualização que permite edição do Subformulário de Itens Cotados na página de detahes do orçamento. Isso está acontecendo demais minha vida pois tenho várias funções nas quais o gatilho de funcionamento
                                                                                                  • Sorting in scorecards

                                                                                                    Hi Can I request the addition of a Sorting feature in the Scorecard widget? We use this to show account manager performance by quarter, or year, or whatever. It's good for side-by-side comparisons. However, it would be more useful if we could choose to
                                                                                                  • CRM

                                                                                                    I have a portal set up where a contact can see other contacts within an account automatically. When a contact in the portal enters a deal, how do I make sure that deal is assigned to the account so other contacts in the account can see the deal was generated?
                                                                                                  • Embedding social media feed into a website

                                                                                                    Are there any tools or widgets available from Zoho that will allow embedding live social media feeds to a website?
                                                                                                  • Issue with syncing zoho campaigns with zoho crm

                                                                                                    Hi there, I want to sync both zoho campaigns with zoho crm however i have encountered some issues with this. when clicking manage in zoho i receive this message even though im using the same account and its an admin account. however when i go to zoho
                                                                                                  • Unable to deregister VAT

                                                                                                    Hi All, My business turnover is below GBP 80,000 and HMRC approved my cancellation for the VAT. However, I am not able to cancel the VAT mapping in the Zoho book. As I should not display it in my company's official document if my company does not have
                                                                                                  • Base Currency Adjustment - Mark Transaction as Something Other than Unreconciled

                                                                                                    Not a very concise title, but it describes the issue pretty well. Basically, when a Base Currency Adjustment is made, the transaction is recorded in the register of the account in question (as it should be). It's marked as "Manually Added", which makes
                                                                                                  • Presence of draft messages are not obvious

                                                                                                    I can't count how many times this has happened to me.  It's at least 20 or 30 times. I go to compose a message to a customer on a ticket, I think I hit "send" but maybe it didn't register, or I moved off the tab for another task and then closed the tab
                                                                                                  • Please Add StatusIQ to Zoho One

                                                                                                    Hi Zoho One Team, I hope you're doing well. We would like to request the inclusion of Zoho StatusIQ as part of the Zoho One suite. Since StatusIQ is already a Zoho product, integrating it into Zoho One would provide organizations with a powerful tool
                                                                                                  • Chromium: On open Writer document , Aw Snap

                                                                                                    Opening Writer document does not work in Chromium browser. On open any document, it appears for the moment, then disappear with Aw Snap! Something went wrong displaying this message. Error code: RESULT_CODE_KILLED_BAD_MESSAGE Chromium: Version 136.0.7065.0
                                                                                                  • Zoho DataPrep: Data Type Does Not Match Column in the Target - Dates

                                                                                                    We are attempting to add a last order date to our customers in Zoho CRM that is pulled from a google spreadsheet. This is the test data fields we are using. When we import into Zoho Dataprep, we get this error. After checking the formatting, it appears
                                                                                                  • How to do the equivalent of object.Parent.Grandparent.Field in Creator?

                                                                                                    I have a form with a parent form and I frequently want to access the parent form data from the UI. One concrete example is an Inventory report. The Inventory has a Product and the product has a classification. I would like to display inventory.Product.Classification
                                                                                                  • Ask the Experts 18: Supercharge Self-Service: Simplify Support, Empower Customers!

                                                                                                    Welcome to the Ask the Experts Session 18 focusing on Zoho Desk’s Self-Service features! With the AI buzzing around like busy bees, ever thought of how you can incorporate AI into Self service? Explore how Zoho Desk's Help Center, Knowledge Base (KB),
                                                                                                  • Possible to filter out contacts that hasn't opened emails in Cadence?

                                                                                                    We use Cadences in various outreach - is it possible in analytics or reports to filter out the contacts that have not opened their emails?
                                                                                                  • how to get the status of customer in the customer portal using deluge script

                                                                                                    From the knowledge I knew, thisapp.portal.profileForUser(); This script able to get the permission of the customer. But, how to get the status of customer (the status I referred is Approved Customer, Pending Customer and Unconfirmed Customer) using the
                                                                                                  • Zoho Finance Workshop 2025 is Happening Now!

                                                                                                    Hello everyone! 👋 We’re thrilled to announce that the Zoho Finance Workshop 2025 has officially started, and we've already wrapped up the event in Chennai, our home ground! After an amazing session, we're geared up to visit more cities in India and take
                                                                                                  • Zoho Inventory: Get Items with sotck on hand in different warehouses in a single shot

                                                                                                    Hello, Is there a way to get all the items with their stock properties per warehouse in a single API call? I'm trying to use this: https://inventory.zoho.com/api/v1/items?organization_id=organizationId it's returning: "item_id": "2767260000000074112",
                                                                                                  • Social Selling: LinkedIn Unified Inbox within SalesInbox

                                                                                                    Can you add LinkedIn Unified Inbox to CRM SalesInbox - this would enable managing LinkedIn Connections Messaging Directly from SalesInbox - adding leads, creating contacts and or potentials within CRM from Linkedin conversations Examples of LinkedIn inbox
                                                                                                  • Collapsible Sections & Section Navigation Needed

                                                                                                    The flexibility of Zoho CRM has expanded greatly in the last few years, to the point that a leads module is now permissible to contain up to 350 fields. We don't use that many, but we are using 168 fields which are broken apart into 18 different sections.
                                                                                                  • Unable to integrate Whatsapp Messaging into Zoho CRM - Business Messaging

                                                                                                    Hello, I want to set up Business Messaging in our Zoho CRM and am struggling to set it up. I have logged into the account and our facebook business page, our business shows in the dropdown for WhatsApp Business Account but does not for WhatsApp Business
                                                                                                  • Automatic field update for Date field with current date + 5 business days?

                                                                                                    I have a custom module which has several stages, and each stage has a deadline. How can I go about updating the "Deadline Date" field to be the current date + 5 business days? Cant find a way to do this with Flow or Blueprints
                                                                                                  • Limits on workflow never disclosed, not documents and now being applied. I feel scammed and there is no reply for support.

                                                                                                    Hello everyone, I’m facing a critical issue with Zoho Recruit and would appreciate any insights from fellow users or someone from Zoho. For months, I’ve been receiving daily emails stating that I have reached the maximum workflow custom functions limit.
                                                                                                  • How Come Deals/Potentials records retrieved using deluge integration functions don't contain 'Pipeline' value but API Get Recrods request DOES return Pipeline

                                                                                                    Hello, Seems like several places this question can be asked so I'll give it a shot here. When using zoho.crm.getRecordById() deluge function and retrieving a record from the Deals/Potentials module the returned data does not include any info about the
                                                                                                  • How to track email open/clicks/bounces in campaigns in Zoho CRM

                                                                                                    I have sent out a mass email to contacts in my campaign on Zoho CRM. I get a signal notification every time an email is opened, clicked or bounced, but this does not automatically update the Campaign Member Status to the appropriate value. Is there a
                                                                                                  • [Resolved] Bug Subform delete row ?

                                                                                                    Hi, I noticed that there was a delay when deleting a row from a subform. I have a script that updates price fields, but when I delete a row, the first row isn't updated, but it is updated on the second row deleted. Here's a video, as well as my script.
                                                                                                  • カスタム関数で新規レコードを作成する際のレイアウト指定方法

                                                                                                    受注書からカスタムボタンで発注書を作成する関数を設定し運用しています。 発注書の新規レコード作成時に、標準(Standard)以外のレイアウトを指定したいのですが、設定がうまくいかず悩んでおります。 https://help.zoho.com/portal/en/community/topic/record-layout-and-api https://help.zoho.com/portal/en/community/topic/solution-deluge-script-to-determine-the-default-layout-for-a-given-user-to-be-used-when-creating-a-new-record
                                                                                                  • Next Page