Automation #13 - Auto assign tickets based on agent shift time

Automation #13 - Auto assign tickets based on agent shift time



This is a monthly series designed to help you get the best out of Desk. We take our cue from what's being discussed or asked about the most in our community. Then we find the right use cases that specifically highlight solutions, ideas and tips to optimize your customer support with the automation capabilities of Zoho Desk.
 
Business working in shifts need to adopt a different dynamic for customer support. For a seamless flow of tickets from one agent to another, it is important to avoid unnecessary delays that make angry customers. A simple two-step automation in Desk will let you ensure your incoming tickets are assigned to agents in the current shift. Giving your customer support teams to work in better co-ordination.
 
To achieve this first the ticket needs to be moved into the unassigned bucket. Then we use a custom function to achieve a round robin mechanism without load balancing to assign these tickets in the current shift.

As always, the first step to making the most of ZohoDesk's automation capabilities is to create a connection to be used in the custom function later. 

To create a  connection, carry out the following steps:
  1. Click on Setup > Developer Space > Connections 
  2. Click Create Connection
  3. In the Pick Your Service section, under Pre-Defined Services find and select Zoho OAuth
  4. In the Connection Details section, add zohodesk as the Connection Name and Connection LinkName
  5. In the Choose Scopes list, select all values that start with 'Desk.' and end with '.ALL' and then include Desk.search.READ, Desk.products.READ
  6. Click Create and Connect
  7. In the page that appears, click Connect
Now move the tickets to the unassigned bucket, by follow these steps:
  1. Go to Setup, and under Automation, click Workflows.
  2. On the left panel, under Workflows, click Rules > Create Rule.
    In the Basic Information section, carry out the following steps:
  3. In the Module drop-down menu, select Tickets.
  4. Enter a name and description for the rule.
  5. If you want to activate the rule right away, select the Active checkbox. Else, you can just create the rule now and activate it later, on the Rules page.
  6. Click Next.
    In the Execute on section, perform the following steps:
  7. Select the Create checkbox to execute this rule every time a new ticket is created.  
  8. Click Next.
    In the Criteria section, do not select any criteria and move to the next section.
    In the Actions section, carry out the following steps:
  9. Click the + icon and select Custom Functions > New
  10. Click Edit Arguments
  11. In the Name field type TicketID, and from the Value drop-down list select Ticket Id under Ticket Information.
    In the script window, input the Custom Function you find below:
    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");
    onlineagents = invokeurl
    [
    url: "
    https://desk.zoho.com/api/v1/onlineAgents?"
    type: GET
    parameters: Param
    connection:"zohodesk"
    ];
    if (onlineagents.notContains(agentId))
    {
    info zoho.desk.update(orgId, "tickets", TicketID,{"assigneeId":null},"zohodesk");

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:


Pre-requisite:
  1. In the Contacts Layout, create two fields:
    1. Add a multi line field and name it as Agent List
    2. Add a single line field and name it as Next Agent
  2. For the values, collect and save all the agentIds in the Agent List and the First Agent in the Next Agent Field. Please note the Agent List should be a comma separated values. 
To create the workflow rule, perform the following steps:
  1. Go to Setup, and under Automation, click Workflows.
  2. On the left panel, under Workflows, click Rules > Create Rule.
    In the Basic Information section, carry out the following steps:
  3. In the Module drop-down menu, select Tickets.
  4. Enter a name and description for the rule.
  5. If you want to activate the rule right away, select the Active checkbox. Else, you can just create the rule now and activate it later, on the Rules page.
  6. Click Next.
    In the Execute on section, perform the following steps:
  7. Select the Create checkbox to execute this rule every time a new ticket is created. 
  8. Click Next.
    In the Criteria section, do not select any criteria and move to the next section.
    In the Actions section, carry out the following steps:
  9. Click the + icon and select Custom Functions > New
  10. Click Edit Arguments
  11. In the Name field type TicketID, and from the Value drop-down list select Ticket Id under Ticket Information.
  12. In the script window, input the Custom Function you find below: 
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 :GET
connection:"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");
}
}
}
}
Note: navigate to Setup > Developer Space > API > to get orgId and replace it in the custom function.
 


    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      • Sticky Posts

      • Zoho Desk Virtual Meetup: US Central, October 5 - 7, 2021

        After the interactive Virtual Meetups in the other regions, we are starting with the US Central and Midwest regions from October 5 to October 7, 2021. The dates for other regions will be announced soon.  At this event, we will explore the topics which
      • Register for Zoho Desk Beta Community

        With the start of the year, we have decided to take a small step in making the life of our customers a little easier. We now have easy access to all our upcoming features and a faster way to request for beta access. We open betas for some of our features
      • Ask the Experts 10: A 5-hour online Q&A on Zoho Desk Best Practices

        Welcome to Zoho Desk's Ask the Experts session! This is a monthly discussion on our  forums; wherein a panel of experts will take on questions  specific to topics related to Zoho Desk. The panel will be available for a 5-hour period and will answer any questions posted here.   Let's begin the year learning some best practices from our experts. In this month's ATE we are opening the floor to questions on how to use Zoho Desk the best way.  If you have a business use case but not sure if Workflow is
      • Share your Zoho Desk story with us!

        Tell us how you use Zoho Desk for your business and inspire others with your story. Be it a simple workflow rule that helps you navigate complex processes or a macro that saves your team a lot of time; share it here and help the community learn and grow with shared knowledge. 
      • Ask the Experts 7: A 5-hour online Q&A on Telephony and Call Module

        Welcome to Ask the Experts session! This is a monthly discussion in forums; each session, a panel of experts will take questions on specific topics related to Zoho Desk. The panel will be available for a 5-hour period and answer any questions posted here. In this month's Ask the Experts, we will take questions on everything related to Telephony and the Call Module in Zoho Desk. We will discuss the following aspects:  Integration with different Telephony vendors Routing calls to agents Converting

      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方