Populating a custom field from certain text in the Summary field

Craig Booth August 15, 2018

We receive an issue via an email from a customer with their reference in the summary field that I want to extract and populate into a custom field automatically.

Summary title:  

REQUT0000504781 - 20180815-  Incident Report A0007

 

From the above summary field I would like to extract 504781 and populate another custom field with this number only.

 

Using the automation pro plugin I have done the followlling:

When: Issue created

 

IF: Issue matches JQL

summary ~ "REQUT00*"

 

Then Edit Issue Fields

{{issue.summary(?=REQUT0000(\d*))}}

 

The "Then" statement above is incorrect however it looks ok within an expression builder from  https://regex101.com/

 

Can anyone offer any further advice / help on this please?

3 answers

1 accepted

0 votes
Answer accepted
Scott Harwood
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 15, 2018

Hi Craig,

 

The correct smart value would be:

{{issue.summary.match("REQUT(\d+).*")}}

Let me know if that works for you.

 

Cheers,

Scott

Raynard Rhodes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2018

@Scott Harwood

Is there documentation on this? I would like to read up on using regex and smart values.

Daniyal Anas March 16, 2022

Hey @Scott Harwood

I appreciate the knowledge you've provided here! I'm curious as to what segment of the above smart value I use to reference the custom field ID/Custom Field?

Greatly appreciated,

Dan A.

0 votes
Craig Booth August 16, 2018

Thanks @Scott Harwood works perfectly. :)

0 votes
Raynard Rhodes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 15, 2018

I'm unsure if you have Jira Workflow Toolbox but you can create a post function that will help with it. 

I am not adept at regex but there is a parser you can use and it explicitly says regex can be used.

This may be a better option than using project automation, I'm unsure if it accepts regex.

Below is "Copy a parsed text to a field" post-function.parse.png

Craig Booth August 15, 2018

Thanks for your response.  I don't currently use Jira Workflow Toolbox but I will install it on our test Jira environment and take a look. 

Suggest an answer

Log in or Sign up to answer