Hello Everyone!
We’re excited to bring you another custom function this week. In this edition, we’ll show you how to automatically close tickets when all associated tasks are marked as completed.
Let’s see how ZylkaPure, a leading water filter company, benefits from this functionality. ZylkaPure specializes in installing and servicing water filters for homes and offices. When a customer books a service, a ticket is created, and the specific tasks required for the service are added to it. As service engineers carry out the necessary work, they update the status of each task. Once all tasks are marked as completed, the system automatically closes the ticket, ensuring a streamlined process and reducing manual follow-ups.
Implementing this custom function in your portal can automate ticket closure and simplify your workflow. Follow these steps to set up the automation in your system.
Prerequisites
1. Create a connection
1.1 Go to Setup and choose Connections under Developer Space.
1.2 Click Create Connection.
1.3 Select Zoho Desk under Default Services.
1.4 Give the connection name as closeticketbytask.
1.5 Under Scope, choose the below scope values:
Desk.activities.READ
Desk.activities.tasks.READ
Desk.tickets.UPDATE
1.6 Click Create and Connect.
1.7 Click Connect and click Accept.
Connection is created successfully.
Create a Workflow Rule
1. Go to Setup, choose Workflows under Automation.
2. Under Workflows, click Rules >> Create Rule.
In the Basic Information section,
3. Select Tasks from the drop-down menu under Module.
4. Enter a Rule Name and Description for the rule.
5. If you want to activate the rule right away, select the Active checkbox. Else, create the rule and activate it later.
6. Click Next.
In the Execute on section, follow these steps:
7. Select Field Update and select the field Status to execute this rule every time the task status is updated.
8. Click Next.
In the Criteria section
9. Specify the criteria as Status is Completed, AND Completed Time is not empty.
10. In the Actions section, click the + icon and select New next to Custom Functions.
11. Enter a Name and Description for the custom function.
12. Under Argument Mapping, give a desired Method Name. Map the arguments as below:
12.1 In the Argument Name field, type taskId and from the Value drop-down list, select Task Id under Task Section.
12.2 In the Argument Name field, type associatedTicketId, and from the Value drop-down list, select Ticket Id under Tasks Section.
13. In the script window, insert the Custom Function given below:
- // ----<<<< User Inputs >>>>----
- // --- Replace ".com" with appropriate domain based on your DC
- deskURL = "https://desk.zoho.in";
- // --- Enter a status name to indicate the 'completed' status of a task ---
- taskCompletedStatusName = "Completed";
- taskCanceledStatusName = "Canceled";
- // --- Enter the name of the custom status to be updated in the Ticket after the completion of all the associated Tasks ---
- statusNameToUpdateInTicket = "Closed";
- // ----<<<< Initial Configs >>>>----
- logs = Map();
- logs.insert("taskId":taskId,"associatedTicketId":associatedTicketId);
- tasksListToProcess = List();
- shallUpdateTicketStatus = false;
- //---------------------------
- try
- {
- // ---- Check to find the Task and Ticket association ----
- isTicketAssociatedWithThisTask = !isNull(associatedTicketId) && !isEmpty(associatedTicketId);
- if(isTicketAssociatedWithThisTask)
- {
- // --- Get the list of all tasks associated with this ticket ---
- getTasksListApiParam = Map();
- getTasksListApiParam.insert("from":0,"limit":100,"isSpam":false,"sortBy":"createdTime");
- logs.insert("getTasksListApiParam":getTasksListApiParam);
- getTasksListApiResponse = invokeurl
- [
- url :deskURL + "/api/v1/tickets/" + associatedTicketId + "/tasks"
- type :GET
- parameters:getTasksListApiParam
- headers:{"Content-Type":"application/json"}
- connection:"closeticketbytask"
- ];
- logs.insert("getTasksListApiResponse":getTasksListApiResponse);
- isValidToProcess_getTasksListApiResponse = !isNull(getTasksListApiResponse) && !isEmpty(getTasksListApiResponse) && getTasksListApiResponse.size() > 0 && getTasksListApiResponse.containsKey("data");
- logs.insert("isValidToProcess_getTasksListApiResponse":isValidToProcess_getTasksListApiResponse);
- if(isValidToProcess_getTasksListApiResponse)
- {
- tasksListToProcess = getTasksListApiResponse.get("data");
- }
- }
- logs.insert("isTicketAssociatedWithThisTask":isTicketAssociatedWithThisTask,"tasksListToProcess_size":tasksListToProcess.size());
- if(tasksListToProcess.size() > 0)
- {
- // --- Check to ensure that all tasks are completed or not ---
- for each currentTaskDetail in tasksListToProcess
- {
- currentTaskStatusName = currentTaskDetail.get("status");
- currentTaskCompletedTime = currentTaskDetail.get("completedTime");
- if((currentTaskStatusName == taskCompletedStatusName || currentTaskStatusName == taskCanceledStatusName) && !isNull(currentTaskCompletedTime))
- {
- shallUpdateTicketStatus = true;
- }
- else
- {
- logs.insert("notCompletedTaskId":currentTaskDetail.get("id"));
- shallUpdateTicketStatus = false;
- break;
- }
- }
- }
- logs.insert("shallUpdateTicketStatus":shallUpdateTicketStatus);
- if(shallUpdateTicketStatus)
- {
- // --- Update status field to the associated ticket ---
- ticketUpdateApiParam = Map();
- ticketUpdateApiParam.insert("status":statusNameToUpdateInTicket);
- logs.insert("ticketUpdateApiParam":ticketUpdateApiParam);
- ticketUpdateApiResponse = invokeurl
- [
- url :deskURL + "/api/v1/tickets/" + associatedTicketId
- type :PATCH
- parameters:ticketUpdateApiParam.toString()
- headers:{"Content-Type":"application/json"}
- connection:"closeticketbytask"
- ];
- logs.insert("ticketUpdateApiResponse":ticketUpdateApiResponse);
- }
- }
- catch (errorInfo)
- {
- logs.insert("errorInfo":errorInfo);
- }
- info "logs: \n" + logs;
- if(logs.containKey("errorInfo"))
- {
- ths "Error happen in the CF execution";
- }
NOTE
a. In Line 3, Replace ".com" with appropriate domain extension based on your Data Center.
In case you have a custom name for the task status or ticket status, you can make suitable changes in the following lines:
b. Line 7 ==> Enter a status name to indicate the 'completed' status of a task
c. Line 9 ==> Enter the name of the status you want to be updated in the Ticket after the completion of all the associated Tasks
14. Click Save to save the custom function.
15. Click Save again to save the workflow.
We trust this solution will streamline your workflow! Stay tuned for more fresh insights and tips to help you make the most of Zoho Desk and optimize your experience.
Recent Topics
Adding custom "lookup" fields in Zoho Customization
How can I add a second “lookup” field in Zoho? I’m trying to create another lookup that pulls from my Contacts, but the option doesn’t appear in the module customization sidebar. In many cases, a single work order involves multiple contacts. Ideally,
Can you import projects into Zoho Projects yet?
I see some very old posts asking about importing project records into Zoho Projects. But I can't find anything up to date about the topic. Has this functionality been added? Importing tasks is helpful. But we do have a project where importing projects
Allocating inventory to specific SO's
Is there a way that allocate inventory to a specific sales order? For example, let's say we have 90 items in stock. Customer 1 orders 100 items. This allocates all 90 items to their order, and they have a back order for the remaining 10 items which could
Introducing Workqueue: your all-in-one view to manage daily work
Hello all, We’re excited to introduce a major productivity boost to your CRM experience: Workqueue, a dynamic, all-in-one workspace that brings every important sales activity, approval, and follow-up right to your fingertips. What is Workqueue? Sales
Zoho Inventory. Preventing Negative Stock in Sales Orders – Best Practices?
Dear Zoho Inventory Community, We’re a small business using Zoho Inventory with a team of sales managers. Unfortunately, some employees occasionally overlook stock levels during order processing, leading to negative inventory issues. Is there a way to
Automation #10 - Auto Assign Ticket based on Keywords
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 on optimizing
Automate attendance tracking with Zoho Cliq Developer Platform
I wish remote work were permanently mandated so we could join work calls from a movie theatre or even while skydiving! But wait, it's time to wake up! The alarm has snoozed twice, and your team has already logged on for the day. Keeping tabs on attendance
Reusable Custom Functions Across Department Workflows
Dear Zoho Desk Team, We appreciate the powerful workflow automation capabilities in Zoho Desk, particularly the ability to create and use custom functions within workflows. However, we have encountered a limitation that impacts efficiency and maintainability.
Contact data removes Account data when creating a quote
Hi, Our customer has address fields in their quote layout which should be the address of the Account. They prefill the information, adding the account name - the address data is populated as per what is in the account - great. However when they then add
Feature Request - Gift Cards or Gift Voucher Capability in Zoho Commerce
Hi Zoho Commerce team, I'm comming accross more and more retail businesses who sell gift cards. As there is currently no way to manage this in Zoho Commerce, it is a blocker to addoption. This is particularly popular in Europe and North America. I recently
Don't Allow Customer to Edit Values After Submitting Ticket
After a customer submits a ticket through the customer portal, they can go into the ticket and see some of the values from the questions they answered in the sidebar. Currently, a customer can edit these values even after they submitted them. This makes no sense. We ask very specific questions that we don't want customers to later change! Please disable the ability for customers to edit the values to their submission questions in the portal. Screenshot attached.
Analytics <-> Invoice Connection DELETED by Zoho
Hi All, I am reaching out today because of a big issue we have at the moment with Zoho Analytics and Zoho Invoice. Our organization relies on Zoho Analytics for most of our reporting (operationnal teams). A few days ago we observed a sync issue with the
text length in list report mobile/tablet
Is there a way to make the full text of a text field appear in the list report on mobile and tablet? With custom layouts, the text is always truncated after a certain number of characters.
Automation #4 - Auto Delete Tickets based on Rules
This is a monthly series in which we pick some common use cases that have been either discussed or most asked about in our community and explain how they can be achieved using one of the automation capabilities in Zoho Desk. Unwanted tickets spamming
Automation #3 - Auto-sync email attachments to tickets
This is a monthly series where we pick some common use cases that have been either discussed or most asked about in our community and explain how they can be achieved using one of the automation capabilities in Zoho Desk. Most of our customers use email
Automation #11 - Auto Update Custom Fields with Values from Emails
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
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
Automation #14: Capture Jira Issue Key/ID in a Ticket Custom Field
Hello Everyone! This month's edition brings you a custom function to consolidate your records associated with Jira integration. Jira integration enables support engineers and R&D units to collaborate seamlessly on feature development, product improvement,
Automation #16: Automate Ticket Reopening on Scheduled Timestamp
Hello Everyone! This edition uncovers the option to schedule reopening a ticket automatically. Zylker Finance tracks insurance policyholder activities through Zoho Desk. For policyholders who pay monthly premiums, tickets are closed upon payment completion.
Automation#19:Auto-Close Tickets Upon Task Completion
Hello Everyone! We’re excited to bring you another custom function this week. In this edition, we’ll show you how to automatically close tickets when all associated tasks are marked as completed. Let’s see how ZylkaPure, a leading water filter company,
Automation #15: Automatically Adding Static Secondary Contacts
Rockel is a top-tier client of Zylker traders. Marcus handles communications with Rockel and would like to add Terence, the CTO of Zylker traders to the email conversations. In this case, the emails coming from user address rockel.com should have Terence
How to apply customized Zoho Crm Home Page to all users?
I have tried to study manuals and play with Zoho CRM but haven't found a way how to apply customized Zoho CRM Home Page as a (default) home page for other CRM users.. How that can be done, if possible? - kipi Moderation Update: Currently, each user has
City field suggestion in Zoho Books
Hi team, We are using Customers module in Zoho Books. In the Address section, we want to understand whether the City field can show suggestions while typing using any API or built-in feature. For example, if a user types “Mum”, can the system suggest
Improved UX design for Projects CRM integration
The current integration embeds the entier projects inteface into the CRM this is confusing and allows users to get lost. For example as a user i navigate to an account and go down to the related projects list and want to get information about a specific
Link Purchase Order to Deal
Zoho Books directly syncs with contacts, vendors and products in Zoho CRM including field mapping. Is there any way to associate vendor purchase orders with deals, so that we can calculate our profit margin for each deal with connected sales invoices
Transformer vos stocks en décisions intelligentes avec Zoho Inventory et Zoho Analytics
Zoho Inventory permet de suivre facilement les niveaux de stock et d’anticiper les restockages. Pour de nombreuses entreprises, cela suffit à gérer les opérations au quotidien. Mais à mesure que l’activité se développe, cette clarté peut commencer à montrer
WorkDrive Download Issue
My client has been sending me files via WorkDrive, which generally has worked fine. Recently files won't download at all. If you try and individually select and download a file, a popup will appear in the bottom right saying it's preparing and then it
Zoho Commerce - Poor Features Set for Blogging
Hi Zoho Commerce team, I'm sure you will have noticed that I have been asking many questions about the Blogs feature in Commerce. I thought that it would be useful if I share my feedback in a constructive way, to highlight the areas which I feel need
Security Enhancements | Migrate to the Updated Policies
Hello everyone, Zoho Directory's security policies have been updated and reorganized into three new policies with features that enhance the overall organization security. These policies provide a stronger and more secure sign-in methods and improve the
Bring Zoho Shifts Capabilities into Zoho People Shift Module
Hello Zoho People Product Team, After a deep review of the Zoho People Shift module and a direct comparison with Zoho Shifts, we would like to raise a feature request and serious concern regarding the current state of shift management in Zoho People.
Zoho Commerce - How To Change Blog Published Date and Author
Hi Commerce Team, I'm discussing a project with a client who wants to move from Woo Commerce / Wordpress to Zoho Commerce. They have around 620 blog posts which will need to be migrated. I am now aware of the blog import feature and I have run some tests.
using the client script based on the look up filed i wnat to fetch the record details like service number , service rate
based on selected service look up field iwant to fetch the service serial number in the serice form how i achive using client script also how i get the current date in the date field in the on load of the form
Quick Create needs Client Script support
As per the title. We need client scripts to apply at a Quick Create level. We enforce logic on the form to ensure data quality, automate field values, etc. However, all this is lost when a user attempts a "Quick Create". It is disappointing because, from
How to block a WhatsApp user for sending spam
Is there a way to block those whatsapp users that just come to play and annoy our service, they also spam us. We have a waba service with sales iq
Inquiry regarding auto-save behavior for Zoho Sign Embedded Sending
Dear Zoho Support Team, I am currently integrating Zoho Sign's Embedded Sending functionality using iframes on my website. I would like to know if there is a way to ensure that the document state (including any added fields) is automatically saved as
Introducing Connected Records to bring business context to every aspect of your work in Zoho CRM for Everyone
Hello Everyone, We are excited to unveil phase one of a powerful enhancement to CRM for Everyone - Connected Records, available only in CRM's Nextgen UI. With CRM for Everyone, businesses can onboard all customer-facing teams onto the CRM platform to
Automation#17: Auto-Create Tasks in Zoho Projects Upon Ticket Creation in Zoho Desk
Hello Everyone, This edition delivers the solution to automatically create a task in Zoho Projects when a ticket is created in Zoho Desk. Zylker Resorts uses Zoho Desk for bookings and handling guest requests. Zylker resorts outsources cab bookings to
Automation#20 : Auto-Add Ticket Tags based on Keywords
Hello Everyone! Welcome to unveiling custom functions on our Community series. This week's post lets you add tags to your tickets automatically based on the keywords in the ticket subject and the ticket thread. Discover how this custom function helps
Automation#21: Track Ticket Transfers Across Departments
Hello Everyone! With Halloween just around the corner, we'd like to let you know the Zoho Desk team is always there to sweep away your customer service troubles! This week, we’re excited to introduce a custom function that tracks tickets moved between
Email Integration - Zoho CRM - OAuth and IMAP
Hello, We are attempting to integrate our Microsoft 365 email with Zoho CRM. We are using the documentation at Email Configuration for IMAP and POP3 (zoho.com) We use Microsoft 365 and per their recommendations (and requirements) for secure email we have
Next Page