Insert Subform Data

Purpose

To insert a new record with subforms in a module.

Request URL

https://www.zohoapis.com/crm/v2/{module_api_name}

Request Method

POST

Scope

scope=ZohoCRM.modules.{module_name}.{operation_type}

Possible module namesPossible operation types
leads, accounts, contacts, deals, campaigns, solutions, products, vendors, custom, notes, and activitiesALL - Full access to a record
WRITE - Edit records in a module
READ - Get records in a module
CREATE - Create records in a module
UPDATE - Update records in a module
Note:

To add multiple subforms, enter the input in the following format.

{
“data”: [
 {
  ....
  Subform_1: [
   {
    sub_form_data
   },
    ],
  ...
 },
 {
  ....
  Subform_2: [
   {
    sub_form_data
   },
    ],
  ...
 }
 ]
}
  • A module can have a maximum of two subforms for all editions except Ultimate. The Ultimate edition can have a maximum of 5 subforms.

  • Every module can have a maximum of 200 subform records with each subform having a maximum of 100 records.

  • A maximum of 5 aggregate custom fields are available for a subform.

  • You must use only Field API names in the input. You can obtain the field API names from

    • Fields metadata API (the value for the key “api_name” for every field). (Or)

    • Setup > Developer Space > APIs > API Names > {{Module}}. Choose “Fields” from the “Filter By” drop-down.

  • If there are no JSON objects given within the subform attribute, that subform will be deleted.

Sample Request

In the request, @newlead.json contains the sample input data.


				curl "https://www.zohoapis.com/crm/v2/Leads"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@newlead.json"
-X POST			

Sample Input

Here, "Languages" and "Availability" are two subforms in the Leads module. "Proficiency" and "Languages_Known" are custom picklists in Languages subform. "Weekends" and "Weekdays" are boolean fields in Availability subform.


				{
    "data": [
        {
            "Last_Name": "Contact_test",
            "Email": "contact_test@xyz.com",
            "Languages": [
                {
                    "Proficiency": "Native",
                    "Languages_Known": "English"
                },
                {
                    "Proficiency": "Professional",
                    "Languages_Known": "French"
                }
            ],
            "Availability":[
            	{
            		"Weekends":false,
            		"Weekdays":true
            	}]
        }
    ]
}			

Sample Response


				{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "Modified_Time": "2019-04-23T16:57:01+05:30",
                "Modified_By": {
                    "name": "Patricia Boyle",
                    "id": "554023000000235011"
                },
                "Created_Time": "2019-04-23T16:57:01+05:30",
                "id": "554023000000480721",
                "Created_By": {
                    "name": "Patricia Boyle",
                    "id": "554023000000235011"
                }
            },
            "message": "record added",
            "status": "success"
        }
    ]
}