Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

smart value output for multiple values

Gomez_ Daniel May 16, 2023

I am working on a smart value in an automation rule action that will send out an email when an issue is created. In the email body I am trying to get the issue description for multiple values but broken down per line. At the moment, with what I am using below I am only getting the first word resolved. My goal is to get all words/numbers,etc to display for each value:

 

Alert : {{issue.description.match(".*Alert : (\S+).*")}}
Start Time : {{issue.description.match(".*Start Time : (\S+).*")}}
End Time : {{issue.description.match(".*End Time : (\S+).*")}}

currently this is the output i get in the description of the new issue created: 

Alert : Alert
Start Time : 04/17/2023
End Time : 04/17/2023

looking for this output:

Alert : Alert DESC
Start Time : 04/17/2023 09:00:00 AM
End Time : 04/17/2023 12:00:00 PM

2 answers

2 accepted

2 votes
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2023

I was thinking this could be much simpler if the "field names" are consistent.

So just for clarity, is this an accurate example of what your Description field might look like?

Text at the beginning
Alert : Alert DESC
Some other text blah blah
Start Time : 04/17/2023 09:00:00 AM
End Time : 04/17/2023 12:00:00 PM
Other text etc etc

If so, then I think this should work:

Alert : {{issue.description.match("Alert : (.+)")}}
Start Time : {{issue.description.match("Start Time : (.+)")}}
End Time : {{issue.description.match("End Time : (.+)")}}

At least it seemed to work when I messed around with it here: 

https://regex101.com/r/S5MUGe/1

Gomez_ Daniel May 18, 2023

that worked!

2 votes
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2023

Your match is removing DESC and the time stamps because the match function is only returning the first one as stated in the documentation.

Performs a regular expression search and returns the first (and only one) matching regular expression group.

Try using \S+\s\S+ and see if that helps.

Suggest an answer

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

Atlassian Community Events