Access Ticket and Thread information in a custom function to send email

Access Ticket and Thread information in a custom function to send email

Hello,

I have a custom fonction which looks like this :

sendmail
[
from :zoho.adminuserid
to :crmAccountWatchers
subject :"[#" + ticketId + "] " + contactName + " from " + accountName + " has submitted a new ticket on 360Eyes Support"
message :"Zoho Desk CRM Account Watcher notification

A new ticket has been submitted at " + createdTime + ".

Department: 360Eyes Support
Account: " + accountName + "
Contact: " + contactName + "
Email: " + email + "
Classification: " + classification + "
Priority: " + priority + "
Subject: " + caseSubject + "
Description: " + description + "

CRM Account Watchers are" + crmAccountWatchers + "."
]
(I removed the HTML tags for a better reading).

The function basically sends a notification email to email address's contained in a field called crmAccountWatchers in Zoho Desk Accounts that is sync from our CRM. I can't use Workflow Alerts because the email address's are contained in a Text Field, not any default system field from Zoho Desk.

I have several questions :

1. The function is triggered in a workflow which runs for any ticket creation, customer or agent reply :



But the email is sent only the first time, when the ticket is created. Then customer or agent replies trigger the workflow but no email are sent. Any idea ?

2. We can only access tickets / accounts / contact information in custom fonction, is it possible to access thread info ? To add last thread content like we can do in notification templates

3. Is it possible to access ticket link in custom function ? To add a like to the ticket like we can do in notification templates

4. The ticket ID that the custom fonction receives is a the technical ID, not the functional ticket ID in Zoho Desk :

Is it possible to get the functional ticket ID ?

Thanks

Leonard