Update a Record

Use the update record task to update values of a particular record, with the record ID.


values_map = Map(); 
values_map.put("<field_name>", "<field_values>"); 
query_map = Map(); 
response_map=zoho.cliq.getRecords("<database_name>", query_map); 
if(response_map.get("status").equalsIgnoreCase("SUCCESS") && response_map.get("list").size()>0)
if(record_id > 0)
    response_map=zoho.cliq.updateRecord("<database_name>", record_id, values_map); 


Let us consider the Zylker IT Administration team which manages the internal queries and support raised by the employees. The employees use the slash command - /raiserequest to notify the team of their query. The /raiserequest command creates a record of this request in the database and returns the following response 

1. Notifies the IT team about a new request raised along with request details ( postToBot task)

2. Notifies the employee who raised a request with a request ID ( postToChat task) 

Now, this request raised by the employee is notified by the ITS Bot to the respective assignee. Once the request has been resolved, the assignee can update the request status by clicking the Mark as Complete button! The record ID of the request will be associated with the button as the reference key. When the request assignee clicks on the Mark as Complete button, the buttonKey variable containing the request ID is used to update the record's status. 

response = Map();
// Use the record ID passed as button arguments to get a record details and update the status
buttonKey = arguments.get("key");
values_map = Map(); 
values_map.put("status", "Closed");  
response_map = zoho.cliq.getRecordById("zylkerrequestmanagement", buttonKey); 
info response_map;
if(response_map.get("status").equalsIgnoreCase("SUCCESS") && response_map.get("object").size() > 0)
if (response_map.get("object").get("status").equalsIgnoreCase("Open"))
	response_map = zoho.cliq.updateRecord("zylkerrequestmanagement", buttonKey , values_map);

response = {"text":"The request " + buttonKey+ " has been marked as complete. :thumbsup:", "bot":{"name":"ITS Bot Notifier", "image":"http://assets.lateral.io/newsbot-bot.png"}};
	response = {"text":"You've updated this request already! \n Request ID: " + buttonKey+ " :thumbsup:", "bot":{"name":"ITS Bot Notifier", "image":"http://assets.lateral.io/newsbot-bot.png"}};
return Map();


Assignee clicks on the Complete button in the request card. This will automatically update the request status from Open to Closed. 

Update request button