Update Subform Data

Purpose

To update a record with subforms in a module.

Request URL

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

Request Method

PUT

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 update multiple subforms, enter the input in the following format.

{
“data”: [
 {
  ....
  Subform_1: [
   {
    sub_form_data
   },
    ],
  ...
 },
 {
  ....
  Subform_2: [
   {
    sub_form_data
   },
    ],
  ...
 }
 ]
}
  • The "ID" of the record (Ex: Lead ID) must be specified in the input.

  • The "ID" of the subform records must be specified.

  • Assuming that there are 3 rows(records) in a subform, if the subform is updated with a new record, the IDs of the other three subform records have to be mentioned. The record without the ID will get deleted. For example, if a subform is updated with a new record along with records 1,3 then it will delete record 2 and create a new record (suppose with Id 4). Therefore, the current subform records are 1, 3 and 4.

  • Updation of subform records without any JSON objects deletes the subform information within the record. Ex: " subform_1:[] "

  • Whenever a record is deleted, all the subform details within the parent record will also get deleted.

  • 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.

Sample Request

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


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

Sample Input


				{
    "data": [
        {
            "id": "554023000000480721",//contact id
            "Languages": [
                {
                    "id": "554023000000480722"//id of the subform record that does not need any update
                },
                {
                    "id":"554023000000480787",//id of the subform record
                    "Proficiency": "Native",//data to be updated
                    "Languages_Known": "French"//data to be updated
                }
            ],
            "Availability": [
                {
                    "id": "554023000000480728"//id of the subform record that does not need any update
                },
                {
                    "id": "554023000000480728",//id of the subform record 
                    "Weekdays": false//data to be updated
                }
            ]
        }
    ]
}			

Sample Response


				{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "Modified_Time": "2019-04-23T17:31:02+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 updated",
            "status": "success"
        }
    ]
}