Recent searches
No recent searches
Support Tip: How to change the ticket Subject using a trigger
Pedro Rodrigues (opservator.com)
Posted Oct 14, 2019
Note: comments added before August 2022 referred to the previous version of this article, when this could be achieved using targets/extensions (which were replaced with webhooks).
The "Email user" action allows us to set the subject/title of the email notification to the requester. The ticket Subject doesn't change, however.
Although there isn't a straightforward trigger action to modify the ticket Subject, we do have a way to achieve this with a Notify active webhook action.
Here's how to do it:
1. Create a webhook to update tickets
Go to Admin Center » Apps and Integrations » Webhooks and create a new webhook (under Actions, on the top-right corner).
Complete the required webhook fields:
- Name. The name of your webhook (e.g. "Update Ticket")
- Endpoint URL: https://yoursubdomain.zendesk.com/api/v2/tickets/{{ticket.id}}.json (make sure to replace 'yoursubdomain' with your own subdomain)
- Request method: PUT
- Request format: JSON
- Complete the Authentication method (use an administrator's credentials)
2. Add webhook action to your trigger
Edit the trigger you want to modify the ticket Subject.
Under Actions, add a Notify active webhook action.
Input the following in the JSON body part of the trigger action:
{"ticket": {"subject": "Your new subject is here!"}}
Example:
That's it! Now you have a trigger action that updates the Ticket Subject.
0
50 comments
Kevin Froleiks
Pedro Rodrigues (opservator.com) thank you for the reply. I checked and the webhook is active.
0
Jans
Hi folks,
Thanks for this info! Question for you - I'm using this to set the subject of our tickets upon creation with the data from a specific field. The trigger seems to successfully update the ticket subject on the agent side, but when I look in the help center, and the email notifications, I still see the old subject. Do you know how I can get the subject to change in the help center and email notifications?
0
Juan
We have a custom form on our website that submits data into a ticket via email but it adds a string of text to the subject (and thus ticket subject) that we do not want in there.
Is there a way to adapt this to remove a specific string of text from the ticket subject and leave the rest of the subject as is?
0
Anne Ronalter
Natively this unfortunately not possible.
But I have found the following Community Post with a workaround for it:
Support Tip: How to change the ticket Subject using a trigger
0
Ulises
Hello, how can I add the Ticket ID to a custom ticket field?
0
Anna Billings
+1 for just being able to do this as a trigger.
Additionally, it looks like the layout for webhooks has changed since this article was created and it could use a refresh to match what's current in the UI.
0
Pedro Rodrigues
Hi Anna Billings, you're right - article updated accordingly! Thank you for the heads up 👍
0
Hannah Lucid
Hi Friends!
![](/hc/user_images/01HHD61X9HP9MJ1M4ZVA71N0S2.png)
I have a webhook that changes the subject of the ticket to be the custom field value chosen for the ticket topic. The problem with this is it displays more like a ticket tag than a readable subject. We use nested values (example::of::topics) that show as (example__of__topics).
How can we get it to not display the __? Instead show example of topics if using the case study above?
0
Nicole
Hannah Lucid, I have a similar issue. Though the team doesn't complain about the underscores, it bothers me, lol. The system pulls in the tags of the fields. So to bypass this, you'd have to change the tags - which is limited itself as you can't use spaces. Also, if you change the tags after the field has been in use, it can mess with historical data and reporting.
0
Hannah Lucid
Nicole not to be dramatic but UGH. I was hoping for spaces instead of underscores. I also noticed that the fields populate in monday.com JUST LIKE THIS but Zendesk states it's a monday.com integration challenge on their end. I'm suspecting that data pulled from text box fields populate as tags in general. :( Unless someone has a REALLY creative idea to assist with this subject line issue specifically :D
0
Paolo
This is expected if you are using the placeholder of a custom field associated with a tag. More information about custom fields is here. The placeholder will only render the exact same text if it is a multi-line or text field.
In addition, the workflow of updating a ticket via a webhook trigger is not recommended due to errors that are likely to happen. You may find more information here for reference: Can I use a trigger and a webhook to update tickets?
Best,
Paolo | Technical Support Engineer | Zendesk
0
Matt Farrington Smith
Hi folks,
Am working on changing the subject line to the following but my custom field is not appearing (only the STAC - Onboarding part)
{
"ticket": {
"subject": "STAC - Onboarding - {{ticket.customField:custom_field_22563332159121}}"
}
}
I presume I'm referencing the custom field incorrectly?
0
Hannah Lucid
Matt Farrington Smith
the placeholder would be {{ticket.ticket_field_22563332159121}}. So the code would be:
{"ticket": {"subject": "STAC - Onboarding - {{ticket.ticket_field_22563332159121}}"}}
1
Matt Farrington Smith
Amazing - that did it, thanks so much Hannah Lucid!
1
Hannah Lucid
Matt Farrington Smith happy to help! Glad it worked. :)
0
Brendan Forti
Hannah Lucid This is a silly way to fix your problem_with_tickets_like_this
But there are invisible space characters you can use in your tickets ( ᅠ) < I copy and pasted it into here. Incase it gets filtered out for some reason you can google “invisible space character” to find it
Simply edit all of your tags to reflect this
0
Hannah Lucid
My Zen-Friends, Brendan Forti Matt Farrington Smith Paolo
I figured it out!
To get the actual field value to populates instead of the tag, use the placeholder: {{ticket.ticket_field_option_title_fieldidhere}}.
Was going through some Zendesk documentation and saw it, figured it was worth a shot and much to my surprise it WORKED!! >:)
0
Vinicius Henrique da Silva
Does anyone have the same problem as me? The trigger is simply executed, however the subject field is not changed.
0
Pedro Rodrigues
Hi Vinicius Henrique da Silva , I just tested the webhook and trigger as described, everything seems to work fine. Can you see if the webhook failed for some reason? Feel free to share a screenshot of the webhook's JSON body in the trigger.
0
Beatriz Almeida
Alguém do zendesk consegue me ajudar a implementar isso? Estou tendo dificuldades.
0