smart value for extracting certain parts of an issue and use it as label

Corinna Haberbosch February 23, 2021

Dear All,

I have created a mail handler in JIRA Core so issues are created for incoming mails.

These mails contain words or catch phrases which are the base for the labels in the issue. I want JIRA to automatically label the issues on the base of the Description.

I have suceeded in setting up the rule for fixed terms:

When: Issue Created

Branch: For Current Issue

Description Contains {{a certain word}}

Then: Edit Issue Fields

 

Now I am wondering if it is also possible that JIRA recognizes a certain word in the Description (let's say "cost") and takes the 10 digits after that word and puts this number in a pre-defined "cost" label?

Thanks for your help!

Best, Corinna

1 answer

1 accepted

0 votes
Answer accepted
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 23, 2021

@Corinna Haberbosch

Sure you can.  Try using the smart value configured like this:

{{issue.description.match(".*cost ([0-9]{10}).*")}}

 

This will grab exactly 10 digits following the text "cost ". If there are fewer than 10 digits it won't work. If you wanted to grab any number of digits, you could instead use a smart value like this:

{{issue.description.match(".*cost ([0-9].*).*")}}

 

My automation rule is configured as follows:

 

Screen Shot 2021-02-23 at 1.21.43 PM.png

Corinna Haberbosch February 24, 2021

Dear Kean,

thank you for the prompt reply.

It doesn't work yet, so here is my concrete use case:

The Description Text contains an ISBN which is formatted as follows:

ISBN: 978-1-5015-1655-9

There is a predefined text field "ISBN" and I want the 17 digits to be drawn into this field.

I have adjusted your smart value suggestion as follows.

Maybe you have another suggestion?

Unbenannt.PNG

Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 24, 2021

Your match function is wrong.


Try this:

{{issue.description.match(".*ISBN: ([0-9]{3}-[0-9]-[0-9]{4}-[0-9]{4}-[0-9]).*")}}
Corinna Haberbosch February 25, 2021

Dear Kian,

ah - now I got the twist :)

I have used this in the meanwhile:

{{issue.description.match("ISBN:\s(.*)")}}

which also worked.

But thanks, that was helpful! I think I understood the rule now.

Best, Corinna

Like Srinivasa Reddy Yeruva likes this

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