Choose where you’d like to start

Update Record

Note: This task is applicable to all Zoho services except Zoho Creator.

Overview

This task is used to update values of a particular record using its ID in a Zoho Cliq database.

This task is based on Zoho Cliq API - Update a record

Syntax

<variable> = zoho.cliq.updateRecord(<database_name>, <record_ID>, <values_map>, <connection>);

where,

ParameterData typeDescription

<response>

KEY-VALUE

specifies the variable which will hold the response returned by Zoho Cliq.

<database_name>

TEXT

specifies the unique name of the database that is to be updated

<record_ID>

NUMBER

specifies the ID of the record which will be updated.

Learn how to fetch the record ID after creating or fetching records.

<values_map>

KEY-VALUE

specifies the new values to update the record, with each key representing the unique column name in the database and the new value to be updated.

<connection>

TEXT

specifies the link name of the Zoho Cliq connection.

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter unless the authtoken is manually deleted from accounts.
  • Add relevant scopes as mentioned in Zoho Cliq API - Update a record
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

Example1: Updating a record with static values

The following script updates the availability to false in the record with ID - 1775XXXX0002XXXX009 of the Zoho Cliq database - availabilitydatabase.

 values_map=Map();
 values_map.put("availability",false);
 
 response_map=zoho.cliq.updateRecord("availabilitydatabase",1775XXXX0002XXXX009,values_map, "cliq_connection");

where,

response_map
is the variable which will hold the KEY-VALUE response returned by Zoho Cliq.
"availabilitydatabase"
is the TEXT that represents the unique name of the database from which the record is updated
1775XXXX0002XXXX009
is the NUMBER that represents the ID of the record that needs to be updated
values_map
is the KEY-VALUE that specifies the new values to update the record
"cliq_connection"
is the TEXT that represents the name of the connection

Example2: Updating a record with dynamic values

Write the below script in the message handler of your Bot configuration to make it update a record of the Zoho Cliq database - availabilitydatabase. The value of the availability field is updated based on the user's response. If the user sends YES to the Bot, the availability field is set to true. Otherwise, it is set with the default value false.

 response=Map();
 dynamic_value=false;
 
 if(message.equalsIgnoreCase("YES"))
 {
 dynamic_value=true;
 }
 
 text = zoho.cliq.updateRecord("availabilitydatabase",1775XXXX0002XXXX423,{"availability":dynamic_value}, "cliq_connection");
 response.put("text",text);
 return response;

where,

message
is the object of TEXT data type that holds the most recent message sent in the Bot
dynamic_value
is the BOOLEAN variable that holds the new value to update the record
"availabilitydatabase"
is the TEXT that represents the unique name of the database whose record needs to be updated
text
is theTEXTvariable that holds the response text to be sent by the Bot
cliq_connection
is the TEXT that represents the name of the connection

Sample Response

Success Response

  • The success response returned is of the following format

     {
     "status":"SUCCESS",
     "url":"/api/v2/storages/availabilitydatabase/records",
     "object":{"empid":"1","name":"Hanna","availability":false,"id":"1775XXXX0002XXXX009"}
     }

Failure Response

  • The failure response returned for an incorrect database name is of the following format

     {
     "status":"FAILURE",
     "message":"Uh-oh! Looks like availabilitydata does not exist.",
     "code":"platform_storage_database_not_found"
     }
  • The failure response returned for an incorrect record ID is of the following format

     {
     "status":"FAILURE",
     "message":"No record found for this id",
     "code":"platform_storage_record_not_exists"
     }

Related Links

Get Started Now

Execute