A Look at Deluge Code in Desk to Update an Account

Look at the code below! And watch the video to understand a few things that you need to keep in mind.

orgId = "11111111"; // (Your Org ID)
// ticket test: 570553000001114017
ticket = zoho.desk.getRecordById(orgId,"tickets",ticket_ID);
// info "Ticket Info: " + ticket;
type = ticket.get("cf").get("cf_request_type");
accountId = ticket.get("accountId");
if(!accountId.isNull() && type != "")
{
 account = zoho.desk.getRecordById(orgId,"accounts",accountId);
 //  info account;
 types = list();
 if(!account.get("cf").get("cf_request_types").isNull())
 {
  types.addAll(account.get("cf").get("cf_request_types").toList(","));
 }
 if(!types.contains(type))
 {
  types.add(type);
 }
 types = types.toString().replaceAll(",",";");
 info types;
 customMap = Map();
 customMap.put("cf_request_types",types);
 customMap.put("cf_sla","24 Hour");
 custUpdate = Map();
 custUpdate.put("cf",customMap);
 update = zoho.desk.update(orgId,"accounts",accountId,custUpdate);
 info "Simple Customer update: " + update;
}
else
{
 info "No customer to update";
}
Back to Lesson