Note: navigate to Setup > Developer Space > API > get orgId and replace in custom function.
To achieve the round robin automation without load balancing, follow these steps:
orgId = "paste orgId here";contactId = "paste contact ID here";TicketInfo = zoho.desk.getRecordById(orgId, "tickets", TicketID,"zohodesk");departmentId = TicketInfo.get("departmentId");agentId = TicketInfo.get("assigneeId");Param = Map();Param.put("departmentId", departmentId);Param.put("limit", "20");checkAvail = invokeurl[url :"https://desk.zoho.com/api/v1/onlineAgents?departmentId=" + departmentId + "&include=mailStatus,phoneStatus,chatStatus,phoneMode,presenceStatus"type :GETconnection:"zohodesk"];if (!checkAvail.toString().contains(agentId.toString())){stopLoop = "false";contactInfo = zoho.desk.getRecordById(orgId,"contacts",contactId);allAgents = contactInfo.getJSON("cf").getJSON("cf_agent_list").toList();elist = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14"};for each agent in elist{contactInfo = zoho.desk.getRecordById(orgId,"contacts",contactId,"zohodesk");nextAgent = contactInfo.getJSON("cf").getJSON("cf_next_agent").toLong();if(checkAvail.toString().contains(nextAgent.toString()) && stopLoop == "false"){assignTicket = zoho.desk.update(orgId,"tickets",TicketID,{"assigneeId":allAgents.get(allAgents.indexOf(nextAgent))},"zohodesk");if(allAgents.indexOf(nextAgent).toLong() < allAgents.size().toLong() - 1){updateContact = zoho.desk.update(orgId,"contacts",contactId,{"cf":{"cf_next_agent":allAgents.get(allAgents.indexOf(nextAgent) + 1)}},"zohodesk");}else{updateContact = zoho.desk.update(orgId,"contacts",contactId,{"cf":{"cf_next_agent":allAgents.get("0")}},"zohodesk");}stopLoop = "true";}else if(stopLoop == "false"){if(allAgents.indexOf(nextAgent).toLong() < allAgents.size().toLong() - 1){updateContact = zoho.desk.update(orgId,"contacts",contactId,{"cf":{"cf_next_agent":allAgents.get(allAgents.indexOf(nextAgent) + 1)}},"zohodesk");}else{updateContact = zoho.desk.update(orgId,"contacts",contactId,{"cf":{"cf_next_agent":allAgents.get("0")}},"zohodesk");}}}}
Writer is a powerful online word processor, designed for collaborative work.