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", <Details map>);

where,
<CRM Response> is the map returned by CRM.
<Details map> is the map variable that holds the key,value pairs. The map key is the label name as specified in the CRM module and the map value is the field value as submitted in the ZC form. For example, "Mailing Street" : (input.account).get("Billing Street") . Here, "Mailing Street" is the label name of the crm module and (input.account).get("Billing Street") refers to the value specified in the Mailing Street field in the account module map.

 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/updaterecords.html 

Share this post :

FacebookTwitter

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

Write to us: support@zohodeveloper.com