Update Records

Updating Records

You can update a record in Zoho CRM using the invokeConnector() Deluge task.

Syntax

<CRM Response> = zoho.crm.invokeConnector("crm.update", <Module & Field values map>);

where,
<CRM Response> is the map returned by CRM.
<Module & Field values> is the map variable that holds the key, value pairs. The two mandatory keys are "module" and "data".

  • module: Specify the module's API name in which the record(s) have to be updated.
  • data: Assign a list containing the key, value pair(s) denoting the field to be updated and the value with which the field should be updated. E.g. "Mailing Street" : (input.account).get("Billing Street"). Here, "Mailing Street" is the label of the field to be updated and (input.account).get("Billing Street") refers to the field in the account module map which will be used to update the field in Contacts module.

 Example

accountId = (input.account).get("Accounts.ID");
resp = zoho.crm.getRelatedRecords("Contacts", ("Accounts"), accountId);
contact_address = map();
contact_address.put("Mailing_Street", (input.account).get("Billing_Street"));
contact_address.put("Mailing_City", (input.account).get("Billing_City"));
contact_address.put("Mailing_State", (input.account).get("Billing_State"));
contact_address.put("Mailing_Zip", (input.account).get("Billing_Code"));
contact_address.put("Mailing_Country", (input.account).get("Billing_Country"));
contact_address.put("Other_Street", (input.account).get("Shipping_Street"));
contact_address.put("Other_City", (input.account).get("Shipping_City"));
contact_address.put("Other_State", (input.account).get("Shipping_State"));
contact_address.put("Other_Zip", (input.account).get("Shipping_Code"));
contact_address.put("Other_Country", (input.account).get("Shipping_Country"));
for each ele in resp
{
 contactId = ele.get("CONTACTID");
 contact_address.put("id", contactId);
 dataList = list();
 dataList.add(contact_address);
 updateMap = {"module":"Contacts", "data": dataList};
 updateResp = zoho.crm.invokeConnector("crm.update", updateMap);
 info updateResp;
}

Mentioned below is the response generated for the above code:

{"status_code":200,"response":"{"data":[{"message":"record updated","details":{"created_by":{"id":"1297376000000094003","name":"ZohoTest"},"id":"1297376000000126001","modified_by":{"id":"1297376000000094003","name":"ZohoDemo"},"modified_time":"2016-06-14T17:10:14+05:30","created_time":"2016-06-14T16:29:43+05:30"},"status":"success","code":"SUCCESS"}]}"}

 Updating a task with Contact and Account Lookup

taskInfo = { "Status" : "In Progress","Task Owner" : input.Owner_Name, "SMOWNERID" : input.Owner_ID, "SEMODULE" : "Accounts", "SEID" : input.Account_ID, "CONTACTID" : input.Contact_ID};
taskInfo.put("id", input.task_ID);
taskList = list();
taskList.add(taskInfo);
updateMap = {"module":"Tasks", "data":taskList};
crmResp = zoho.crm.invokeConnector("crm.update", updateMap);

 Related Links

https://www.zoho.com/crm/help/api/v2/#update-specify-records 

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeveloper.com