Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.



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.

Email is one of the most commonly used support channels and with Desk's easy setup you can easily convert your customer conversation into tickets. All you need to do is to forward the emails received at your support mailbox to Zoho Desk and every customer conversation is converted into tickets with a unique ticket ID.
 
The subject of the email is pulled and displayed as a tickets with a ticket ID in Desk. If you want to go a step ahead and pull the email content into the ticket description, then automations can come in handy. Using a simple custom script and a workflow rule you can create an automation to automatically update the email content in to the description field of the ticket in Desk. This helps you have all the context you need to resolve a ticket at one single place and avoid going back and forth between your inbox and help desk platform.
 
To create the workflow rule, perform the following steps:
  1. Go to Setup, and under Automation, click Workflows.
  2. Click "Create Rule" from top right corner.
    In the Basic Information section, perform 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.
  9. In the Criteria section, add "Channel Is Email" and click "Next".
    In the Actions section, perform the following steps:
  10. Click the + icon under "Action" and select "New" next to Custom Functions
  11. Enter a name and description for the custom function.
  12. In the script window, input the Custom Function you find below:

    1. OrgID = Paste your OrgID here;
    2. getthreads = zoho.desk.getRelatedRecords(OrgID,"threads","tickets",ticketId,0,1);
    3. threadid = getthreads.getJSON("data").getJSON("id");
    4. getthreadcontent = zoho.desk.getRelatedRecordById(OrgID,"threads",threadid,"tickets",ticketId).getJSON("content");
    5. updateticket = zoho.desk.update(OrgID,"tickets",ticketId,{"description":getthreadcontent});
    6. info updateticket;

  13. Click "Edit Arguments"
  14. In the Name field type ticketId, and from the Value drop-down list select Ticket Id under Ticket Information
  15. Click "Save" to save the custom function.
  16. Click "Save" again to save the workflow.
Important Note: In line 1, replace your OrgId. You can get your OrgID by navigating to Setup > Developer Space > API > OrgId.

28 Replies
Reply
8 more

The system should copy the first 100 words of an email of the ticket and copy it on Description and if the text is beyond 100 words, then the system should replace additional words with three dots ...

Need Solution for this.

We need to tweak the custom function script for your requirement, Rafay. Hit us up at support@zohodesk.com, we shall share the modified custom function.

Regards,
Ajith | Zoho Desk

could you please share the above tweaked script to me. I need the same solution with the first 100 words. The original script at the top of this thread is not working at all for me. it does not update the ticket description. your help would be much appreciated.

Please hit us up at support@zohodesk.com for the sample custom function script, Matthew.

Regards,
Ajith | Zoho Desk

  • 1 year ago

I am trying to have the Content of the email submitted for the ticket updated into the Description field. I am following the instructions above but I am getting an error = "Variable 'ticketId' is not defined Line Number : 2" this is an older thread so maybe some of the scripting changed?

ZohoError.JPG
ZohoError.JPG53 KB
  • 1 year ago

Given the nature of this request, we'd suggest reaching out to us at support@zohodesk.com. Hope this guides you to the appropriate channel. Thank you, @cklinker.


Regards,
Ash | Zoho Desk

When I try to safe the script I get the following error:

Failed to update function
Variable 'ticketId' is not defined Line Number : 2


Hi

,

This error likely occurs due to unmapped arguments. Ensure steps 13 and 14 have been thoroughly completed.

Attached is the live UI screenshots for your reference.

Try this and let us know how it goes!

Regards,
Shivani | Zoho Desk

Screenshot 06-08-2024 at 21.13 (1).png
Screenshot 06-08-2024 at 21.13 (1).png226 KB
Screenshot 06-08-2024 at 21.13.png
Screenshot 06-08-2024 at 21.13.png312 KB

The reason is that you call the argument in step 14 "TicketID". Within the script it is called "ticketId". The difference leads to that error.

Hi
,

Thanks for bringing this to our attention. We've made the necessary updates to the Announcement post :) 

Cheers,
Shivani | Zoho Desk

Is it possible to execute that script on an array of tickets (ie. from a report or a view)?

Hi

,

Yes, you can indeed link the Custom Function created in Macro Automation to run across a series of tickets within a Custom View—just be mindful not to update too many tickets at once, as it might hit the API threshold.

Regards,  
Shivani | Zoho Desk

Can you give me a hint how to do this?

Hi

,

Absolutely! Apologies for missing this earlier.

Create a Macro by navigating to Setup -> Automation -> Macro -> All actions -> and associate the Custom Function you’ve created.

Then, go to your Ticket view -> Select all tickets in the view -> Apply Macro -> and choose the created automation.

For your reference,


This will only trigger the function for the records in the view, not for all tickets.

Give it a go, and let us know how it works out!

Cheers,  
Shivani | Zoho Desk

Ist it possible to access the receivedAt/sentTo email address of an ticket in a similar way? What would the JSON parameter be instead of "content" in: getJSON("content")?

Hi

,

Could you clarify if you’re referring to the direct support email address from which the email was received or the forwarding address to which it was sent?  

Cheers,  
Shivani | Zoho Desk  

I am referring to the email address the email was originally sent to (here: support+xyz@mycompany.de). I do not mean the ZOHO support email address (like xyz@mycompany.zohodesk.eu).

Thanks for the clarification,
! Yes, it’s absolutely possible.  

Shoot us an email to support@zohodesk.com with the complete use case—specifically where the email address value needs to be filled. We’ll assist you in tweaking this function.  

Cheers,  
Shivani | Zoho Desk  

Are you sure? Your answer to ticket id #108218841 has been different...

Apologies for the confusion! We’ve understood the use case shared in the ticket and will forward your request to our development team for further action. I’ll keep you updated on the progress within the same ticket.  

Thanks for your understanding,  
Shivani | Zoho Desk  

Reply to Chinmayee MishraA
/* */
  • 12
  • Insert
  • Plain text
Add Comment
(Up to 20 MB )