Hi, I want to set external ticket number to customfield by searching it in issue's comments
I have smartvalue code like: {{#issue.comments}}{{body.match(".*Ticket number: \s*(.*)")}}{{/}}
but this give me result like :
Problem is that the number is repeated three times, because it is in three comments.
How to I get only first match in smartvalue?
i try:
{{#issue.comments}}{{body.match(".*Ticket number: \s*(.*)").get(0)}}{{/}}
but it doesn't work
The match() function can produce a collection (not a list) when there are multiple values found. If you want just one match, perhaps convert to a list with split() and grab the first one.
{{issue.comments.body.match(".*Ticket number: \s*(.*)").split(",").first}}
Kind regards,
Bill
Thanks a lot for the clarification. It works great
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Arkadiusz Baka - Perhaps set the trigger to comment added so that it executes against the current comment instead of searching through all issue comments. You could do something like this:
{{comment.body.match(".*Ticket number: \s*(.*)")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I need to check the existing comments because I want to update the existing tickets.
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.