The use case requires building a custom application that can assign tickets to respective departments in Zoho Desk based on the subject line or the content of the body of the email. This can be extended to similar scenarios like:
- Assigning tickets to agents based on custom criteria
- Updating status of tickets based on criteria
- Assigning a case record in CRM to a case owner Solution Diagram
Solution Diagram:
Level 1 : Uploading mappings one-by-one
Level 2 : Upload mappings using a csv
Level 3: Sync department details to Catalyst Data Store
Step 1: Database Schema
The Catalyst Data Store is a relational database that can store the mappings. The first step would be the setting up of the respective tables in the Catalyst Data Store. We'd definitely need a table to set up the OrderID, and department details mapping. Next, we set up the columns for the MappingTable. We've created two columns, OrderID and Team. We'd recommend setting up constraints like unique and mandatory if possible. Every table in the Catalyst Data Store will contain the ROWID, CREEATORID, CREATEDTIME, and MODIFIEDTIME columns by default.
Next, we create a Department table where we store the mapping between the DepartmentID and the DepartmentName. We do this because Desk APIs accept DepartmentID as input whereas the end-user will be typing in Department names.
For more information, please check the attachments.
Step 2: Setting up the functions
Functions perform the compute operation in our project. We will use only the Advanced I/O function to do this. Advanced I/O Functions support Java and Nodejs. We'd need an API to insert into the Mapping table. We assume 'team' would be an ID for simplicity sake.
- //Used to insert rows into MappingTable
- //Takes a json object body with the keys OrderID, Team
- app.post("/row", (req, res) => {
- //initialise catalystApp
- const catalystApp = catalyst.initialize(req);
- //varaibles from json requestBody
- const requestBody = req.body;
- let order_id = requestBody.OrderID;
- let team = requestBody.Team;
- //initialise row data
- let rowData =
- {
- OrderID: order_id,
- Team: team
- };
- let datastore = catalystApp.datastore();
- let table = datastore.table('MappingTable');
- let insertPromise = table.insertRow(rowData);
- insertPromise.then((row) => {
- console.log(row);
- res.send({"Message":"Row inserted successfully"})
- }).catch((err) => {
- console.log(err);
- res.status(500).send(err);
- });;
- });
Now that we've inserted a mapping, we can use the GET API to get the respective mappings
- //Get team name when orderID is provided as input
- app.get("/row", async(req, res) => {
- let catalystApp = catalyst.initialize(req, {type: catalyst.type.applogic});
- const requestQuery = req.query;
- let order_id = requestQuery.order_id;
- let select_promise = await select_query(order_id,'SELECT Team FROM MappingTable where OrderID='+order_id+";",catalystApp,res);
- res.send({
- "Message":select_promise
- })
- }
Similarly, we'd need a function for assigning the ticket to the Department using the following API.
A neat trick is to try this in Postman and switch it to Nodejs code using the code option. Nodejs Connector can be used to generate the access token using the refresh token.
Step 3: Set up the Web Client
The Web Client can be built using Angular, React or Simple HTML, CSS and Javascript. We've set up a very simple web client. It's possible to set up better web clients that invoke the REST APIs according to your use case.
Please find attachment
Step 4: Set up the webhook
This entire solution can be thought of on three levels :
- First level: adding mappings one at a time
- Bulk addition of OrderID, Department Mappings
- CRON function to sync DepartmentID, Departmentname mapping
Feel free to write to us at support@zohocatalyst.com if you have any questions.
Announcements
React Nexus 2025 Recap: Catalyst Slate in Action!
Hey Catalyst Community! We recently attended the React Nexus 2025 conference, an exciting gathering for frontend enthusiasts and React developers. Our team had an incredible time presenting and conducting a hands-on workshop on Catalyst Slate, our streamlined
[Webinar] A hands-on guide to Catalyst Stratus
Have you used Catalyst Stratus yet? It’s an object storage service that makes it easy to handle large files — whether they're coming from your Catalyst app or other Zoho apps. We’re hosting a live coding session where you’ll build a working prototype
Catalyst Video Tutorials!
Hello everyone! We’ve been brewing something exciting behind the scenes, and we’re thrilled to finally share it with you- Catalyst video tutorials are here! We recognized that videos are the predominant medium for learning and discovery these days, so
[Webinar] Catalyst Cloud Browser in Action: PDF & Web Rendering Solutions for Regulated Industries
Hi everyone, Have you ever struggled with rigid PDF tools or clunky rendering logic in BFSI or healthcare apps? Do your clients struggle to deliver compliant, dynamic, and automated documents — and most are still stuck with brittle, server-heavy PDF generation?
Announcing Catalyst Developer Bootcamps in India - Zoho Community
Hey everyone! We're excited to announce a set of developer bootcamps dedicated to Catalyst! These bootcamps are aimed to empower developers to build, scale, and deploy applications with speed and precision, using Catalyst. Whether you're a newcomer or