Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Value Extract part from comment

KLINGER Servicedesk June 22, 2025

Dear community,

 

How can I create a variable as part of an automation with T20250611.0010 from a comment like this:

Der Status Ihres Tickets hat sich geändert auf: Zugewiesen

Gerne können Sie den Verlauf Ihres Tickets in unserer Kundenzone auch selbst überprüfen. Klicken Sie schnell und einfach auf folgenden Link, um direkt auf die Kundenzone zuzugreifen: T20250611.0010. Falls Sie nicht über einen Zugang zum Kundenportal verfügen, diese aber gerne nutzen würden, kontaktieren Sie uns.

 Mit freundlichen Grüßen,

 

With {{comment.body.match("zuzugreifen:\\s*(T\\d{8}\\.\\d{4})<").get(0)}} the log is empty.

 

Thanks for help! 

 

3 answers

1 accepted

3 votes
Answer accepted
Thorsten Letschert _Decadis AG_
Atlassian Partner
June 22, 2025

Hey @KLINGER Servicedesk ,

Please try

{{issue.comment.body.match("(T\d{8}\.\d{4})")}}

I also had a little trouble with escaping and brackets, but this one finally returned the desired result for me, given your example comment.

Edit, since this has resolved the initial request:

The working query in this scenario (being robust against multiple entries):

{{issue.comments.last.body.match("(T\d{8}\.\d{4})")}} 

Regards from Koblenz/Germany
Thorsten 

KLINGER Servicedesk June 23, 2025

Hi Thorsten,

Thanks for your input.

I created a log and its still empty. :-(

Greetings from Vienna!

Bernd

I already asked Google Gemine, Deep Seek and ChatGPT. Every answer was looking fine, but didn´t work.

 

Thorsten Letschert _Decadis AG_
Atlassian Partner
June 23, 2025

Hey Bernd,

We might be able to narrow down your problem if I learn more about the specific usage. As you can see below, using the expression provided within an Add comment action works (even for multiple matches):community_automation-matches-regex.PNG

What action are you trying to use and how should the result look like?

Regards,
Thorsten

KLINGER Servicedesk June 23, 2025

Hi Thorsten,

this email comes from our supplier. And I want to extract their ticket ID (T20250611.0015) and populate it in our Jira field "External Ticket ID". Therefore I created an automation which shall do this. I tried to access the email body directly and to create a variable with the email body. And in the automation I created logs for every step. The log for the email body is working. But whatever I do the log for the "External Ticket ID" is always empty (see attachment).

 

Finally I want to have our custom field "External Ticket ID" populated with the ticket ID from each email.

 

KLINGER Servicedesk June 23, 2025

Working!

image.png

KLINGER Servicedesk June 23, 2025

Not Working!

{{comment.body.match("zuzugreifen:\\s*(T\\d{8}\\.\\d{4})<").get(0)}}

image.png

KLINGER Servicedesk June 23, 2025

Not working!

{{VarLatestComment.match(".*zuzugreifen:\\s*(T\\d{8}\\.\\d{4})<.*").get(0)}}

image.png

KLINGER Servicedesk June 23, 2025

Not working

{{issue.comment.body.match("(T\d{8}\.\d{4})")}}

image.png

Thorsten Letschert _Decadis AG_
Atlassian Partner
June 23, 2025

What custom field type is your 'External Ticket ID'?

Thorsten Letschert _Decadis AG_
Atlassian Partner
June 23, 2025

Assuming it's 'Short text (plain text only)', the following configuration works fine for me:

  • Trigger: Work item commented - I've not used email for testing
  • Action: Edit work item - your 'External Ticket ID' with the expression as follows
{{issue.comments.last.body.match("(T\d{8}\.\d{4})")}}

community_automation-matches-regex02.PNG

Please note the slightly different expression needed to have a single value returned.

The result looks like this:

community_automation-matches-regex03.PNG

I'm sure we're not far from the solution. 😊

Regards,
Thorsten

KLINGER Servicedesk June 24, 2025

Hi Thorsten, thxs its working but I cant see the "slightly different" you have mentioned and I would like to understand why it was NOT working before. If you need some information about scrum master- or pmi certification you can contact me. ;-)

Thorsten Letschert _Decadis AG_
Atlassian Partner
June 24, 2025

You're more than welcome. Glad to hear it's working now. The following screenshot illustrates the difference in the results. The "slightly" was referring to the usage of "comments.last" (mark the "s") vs. "comment":

community_automation-matches-regex04.PNG

So, while the first expression evaluates the comment section as a whole, it seems like the latter version is needed to easily point to a single comment.

Regards,
Thorsten

0 votes
Anusha A
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 23, 2025

Hi @KLINGER Servicedesk

I see that two answers are accepted. Can you please provide the pending query so that I can escalate it through a support ticket for our experts to address this?

Regards,
Anusha A 

KLINGER Servicedesk June 24, 2025

Hi Anusha, this query is working: 

{{issue.comments.last.body.match("(T\d{8}\.\d{4})")}} 
0 votes
KLINGER Servicedesk June 23, 2025

Technically I "Create variable" with the respective smart value (which should deliver the external ticket ID")

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events