Hi Team,
We have an automated email ticket creation using a script that takes certain keywords from the email body and adds them to the ticket summary. However, the summary's formatting is not displaying correctly. Is there a way to use a JMWE post-function, Nunjucks, to trim the summary before creating the ticket (correct the summary)
I've attached a screenshot for reference; the section marked in red is common across all tickets, but in the total:1, the numbers vary all the time. We would like to trim that part.
Here is a solution using Jira Automation (native in Cloud, or installable in Data Center via Atlassian's official app):
Automation Rule:
{{issue.summary.replaceAll("total: \d+", "").trim()}}
It will remove any total: <number> from the summary.
Original summary:
*Order 123, Ready to go total: 1
Updated summary:
*Order 123, Ready to go
Original summary:
*Testing Status total: 25
Updated summary:
*Testing Status
The same regex pattern should also work with a JMWE post-function using Nunjucks, although I haven't tested it directly as I don’t have JMWE installed at the moment.
Hope that helps!
Thank you @Michael Wan , The trim worked perfectly for the last part, I am still looking for how to trim the asterisk (*), at the very start of the summary, then it will be perfect in every case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad that it works @Lakshmi CH . This should address the leading asterisk:
{{issue.summary.replaceAll("^\*\s*", "").replaceAll("total: \d+", "").trim()}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you sooooo much @Michael Wan . It worked perfectly, so the final output of the trimmed summary is :
If anyone wants to refer to the automation in the future, here it is.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would need to experiment to know for sure, but that seems like it could be a job for slice:
`{{summary.slice(1, -10)}}`
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jim Knepley - ReleaseTEAM , I am sorry, Please find the attached one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.