Update a Specific Record
Purpose
To update a particular entity or record.
Request URL
https://www.zohoapis.com/crm/v2/{module_api_name}/{record_id}
module_api_name - The API name of the module
record_id - The unique ID of the record
Modules supported in Get a Specific Record are supported here.
Request Method
PUT
Scope
scope=ZohoCRM.modules.all
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
Possible module names | Possible operation types |
---|---|
leads, accounts, contacts, deals, campaigns, tasks, cases, events, calls, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, custom, notes, and activities | ALL - Full access to the record WRITE - Edit records in the module UPDATE - Update records in the module |
Note:
An error is thrown if the field value length is more than the maximum length defined for that field.
If an API is used inside a Function and the field value length exceeds the limit, then that function receives error response from the API. For ex: If the max length for a "Text field" is defined as 10, then value given for it in API cannot be "12345678901", as it has 11 characters.
Duplicates are checked for every insert record API call based on unique fields.
A maximum of 100 records can be inserted per API call.
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.
The trigger input can be workflow, approval, or blueprint. If the trigger is not mentioned, the workflows, approvals and blueprints related to the API will get executed. Enter the trigger value as [] to not execute the workflows.
If the update API calls for a record are from DRE(Functions), due to workflow triggered on the same record's create / update, workflow alone will not get executed, irrespective of the trigger param configuration.
Records with Subform details can also be updated to CRM using the Records API. Please look at Subforms API to learn more about updating subform information within a record.
Refer Response Structure for more details about the JSON keys, values, and their descriptions. You can also use the sample response of each module as the input when you insert, update, or upsert a record in that corresponding module.
Sample Attributes
The following table gives you specific details about each field type in Zoho CRM and their limitations.
The JSON type and the data type of the field-types are extracted from fields meta data API.
JSON type - Tells in what format the field should be passed in request-body or will be received in response.
Data type - Tells the type of data that can be stored in the corresponding field-type. It is mentioned below each Attribute.
Attribute | JSON Type | Limitations | Sample |
---|---|---|---|
Single Line Text | String | Accepts up to 255 characters. Accepts alphanumeric and special characters. | "Last_Name": "Mike O'Leary" |
Multi Line Textarea | String | Small - accepts up to 2000 characters. Large - accepts up to 32000 characters. You will not be able to use this field to create custom views, reports or other filters. Accepts alphanumeric and special characters. | "Multi_Line_1": "This is the first line \n Now for the second Line" |
Email | String | Accepts valid email IDs. | "Email_1": "p.boyle@zylker.com" |
Phone Phone | String | Accepts up to 30 characters. This limit may vary based on the value configured in 'Number of characters allowed' in the properties pop-up of the field, in UI. Accepts only numeric characters and '+' (to add extensions). The regex pattern in Zoho CRM to validate this field's value is "[0-9a-zA-Z!#;%\\*\\^\\(\\)=\\{\\}\\[\\]\\?`~_\\-\\.\\$@\\?\\,\\:\\'\\/\\!\\P{InBasicLatin}\\|\\\\\\s\\+]+" | "Phone_1": "9900000000" |
Picklist Picklist | String | You can either pass an existing pick list value or add a new one. The pick list value accepts all alphanumeric and special characters. | "Industry": "automobile" |
Multi-Select Picklist Multi-select Picklist | JSON array | You can either pass existing pick list values or add a new one. The pick list value accepts all alphanumeric and special characters. | "Courses_Opted": [ "Analytics", "Big data" ] |
Date Date in ISO 8601 format | String | Accepts date in yyyy-MM-dd format | "Date_1": "2017-08-16" |
Date/time DateTime in ISO 8601 format | String | Accepts date and time in yyyy-MM-ddTHH:mm:ss±HH:mm ISO 8601 format | "Date_Time": "2017-08-16T14:32:23+05:30" Date_Time is in ISO8601 format and the time zone is the current user's time zone. |
Number Integer | Integer | Accepts numbers up to 9 digits. This limit may vary based on the value configured in 'Maximum digits allowed' in the properties pop-up of the field, in UI. Accepts only numeric values. | "No_of_Employees": 350 |
Currency Currency | Double | Before decimal point - accepts numbers up to 16 digits. This limit may vary based on the value configured in 'Maximum digits allowed' in the properties pop-up of the field, in UI. After decimal point - accepts precision up to 9 digits. This limit may vary based on the value configured in 'Number of decimal places' in the properties pop-up of the field, in UI. Accepts only numeric values. | "Annual_Revenue": 250000.90 |
Decimal Double | Double | Before decimal point - accepts numbers up to 16 digits. This limit may vary based on the value configured in 'Maximum digits allowed' in the properties pop-up of the field, in UI. After decimal point - accepts precision up to 9 digits. This limit may vary based on the value configured in 'Number of decimal places' in the properties pop-up of the field, in UI. Accepts only numeric values. | "Decimal_1": 250000.50 |
Percent Double | Double | Accepts numbers up to 5 digits. Accepts only numeric values. | "Percentage": 25 |
Long Integer BigInt | String | Accepts numbers up to 18 digits. This limit may vary based on the value configured in 'Maximum digits allowed' in the properties pop-up of the field, in UI. Accepts only numeric values. | "EAN_Code":"0012345600012" |
Checkbox Boolean | Boolean | Accepts only Boolean values(true,false). | "Email_Opt_Out": true |
URL Website | String | Accepts valid URLs. The regex pattern in Zoho CRM to validate this field's value is "^(http:\\/\\/www.|https:\\/\\/www.|ftp:\\/\\/www.|www.|http:\\/\\/|https:\\/\\/|ftp:\\/\\/|){1}[^\\x00-\\x19\\x22-\\x27\\x2A-\\x2C\\x2E-\\x2F\\x3A-\\x40\\x5B-\\x5E\\x60\\x7B\\x7D-\\x7F]+(\\.[^\\x00-\\x19\\x22\\x24-\\x2C\\x2E-\\x2F\\x3C\\x3E\\x40\\x5B-\\x5E\\x60\\x7B\\x7D-\\x7F]+)+(\\/[^\\x00-\\x19\\x22\\x3C\\x3E\\x5E\\x7B\\x7D-\\x7D\\x7F]*)*$" | "URL": "https://www.zylker.com" |
Lookup Lookup | JSON object | Accepts valid name and unique ID of the record, which you can get through meta data API. | "Lookup" : { "name" : "James", "id" : "425248000000104001" } |
Multi-select lookup Multi-Select Lookup | JSON array | Accepts valid record names and unique IDs. | "Accounts":[ { "Account_Name":"Zylker1", "id":"4150868000000420069" }, { "Account_Name":"Zylker", "id":"4150868000000420046" } ] |
User User Lookup | JSON object | This is a default look-up field to users in Zoho CRM. | "User": { "name":"Patricia Boyle", "id":"4150868000000623001" } |
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v2/Leads/554023000000527002"
-X PUT
-d "@updatelead.json"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
CopiedZCRMRecord record = ZCRMRecord.getInstance("Products",1234567l);// module api name with its record id
record.setFieldValue("Product_Name","name");// field api name with the value to be updated
ZCRMRecord lookup = ZCRMRecord.getInstance("Vendors",123456789l);// vendor module api name with its record id
record.setFieldValue("Vendor_Name", lookup);
APIResponse response = record.update();
ZCRMRecord updatedRecord = (ZCRMRecord) response.getData();
String recStatus = response.getStatus(); // check status of the record
Copied$zcrmRecordIns = ZCRMRecord::getInstance("Leads", 410405000001304021);
$zcrmRecordIns->setFieldValue("Product_Name", “iPhone 6s Plus”);
$apiResponse=$zcrmRecordIns->update();
Copieddef update_record(self):
try:
record=ZCRMRecord.get_instance('Leads',410888000000698006)#410888000000698006 is leadid
record.set_field_value('Last_Name', 'Python')
record.set_field_value('Mobile', '9999999999')
record.set_field_value('Phone', '9999999998')
user=ZCRMUser.get_instance(1386586000000105001,'Python User1')
record.set_field_value('Email', 'support@zohocrm.com')
record.set_field_value('Owner',user)
resp=record.update()
print(resp.status_code)
print(resp.code)
print(resp.details)
print(resp.message)
print(resp.status)
except ZCRMException as ex:
print(ex.status_code)
print(ex.error_message)
print(ex.error_code)
print(ex.error_details)
print(ex.error_content)
CopiedSyntax:
zoho.crm.update(<module String>,<recordID Long>,<dataMap Map>,<optionalDataMap Map>,<connectionName String>,<userAccess Boolean>);
mandatory : module,recordID,dataMap
Sample Request:
resp = zoho.crm.update("Price_Books", "410888000000698006", {"Owner": {"id": "410888000000086001"},"Active": true,"Pricing_Details": [{"to_range": 5,"discount": 0,"from_range": 1},{"to_range": 11,"discount": 1,"from_range": 6},{"to_range": 17,"discount": 2,"from_range": 12},{"to_range": 23,"discount": 3,"from_range": 18},{"to_range": 29,"discount": 4,"from_range": 24}],"Pricing_Model": "Differential","Description": "Design your own layouts that align your business processes precisely. Assign them to profiles appropriately.","Price_Book_Name": "Price_Book_Name oops1 updated twice"});
CopiedZCRMRecord recordIns = ZCRMRecord.GetInstance("Products", 3372164000001633018);// module api name with its record id
recordIns.SetFieldValue("Product_Name", "name");// field api name with the value to be updated
ZCRMRecord lookup = ZCRMRecord.GetInstance("Vendors", 3372164000000531084);// vendor module api name with its record id
recordIns.SetFieldValue("Vendor_Name", lookup);
APIResponse response = recordIns.Update();
ZCRMRecord updatedRecord = (ZCRMRecord)response.Data;
Sample Response
Copied{
"data": [
{
"Company": "Zylker",
"State":"Baltimore"
}
],
"trigger": [
"approval"
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "554023000000527002",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410405000001304021",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "3372164000001633018",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Sample Response
Copied{
"data": [
{
"Company": "Zylker",
"State":"Baltimore"
}
],
"trigger": [
"approval"
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "554023000000527002",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410405000001304021",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "3372164000001633018",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Sample Response
Copied{
"data": [
{
"Company": "Zylker",
"State":"Baltimore"
}
],
"trigger": [
"approval"
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "554023000000527002",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410405000001304021",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "3372164000001633018",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Sample Response
Copied{
"data": [
{
"Company": "Zylker",
"State":"Baltimore"
}
],
"trigger": [
"approval"
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "554023000000527002",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410405000001304021",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "3372164000001633018",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Sample Response
Copied{
"data": [
{
"Company": "Zylker",
"State":"Baltimore"
}
],
"trigger": [
"approval"
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "554023000000527002",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410405000001304021",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "410888000000698006",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"created_time": "2016-08-09T16:27:05+05:30",
"modified_time": "2016-09-15T14:26:52+05:30",
"modified_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
},
"id": "3372164000001633018",
"created_by": {
"name": "Patricia Boyle",
"id": "410888000000086001"
}
},
"message": "record updated",
"status": "success"
}
]
}