Forums

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

Set custom field from extracted text

Oleksandr Tymofyeyev
Contributor
August 24, 2023

Hi.

How would I go about getting a date from a Jira issue description (some of our issues always have the text "Effective date: 01.01.23") and set this date in a custom field "Due Date"

Screenshot 2023-08-24 164745.png?

1 answer

1 vote
Kian Stack Mumo Systems
Community Champion
August 24, 2023

@Oleksandr Tymofyeyev

 

I did it like this:

 

First, I performed a match to check if the Description contains the string you are looking for. The smart value should be 

".*Effective date: ([0-9]{0,2}.[0-9]{0,2}.[0-9]{2}).*"

 

Screen Shot 2023-08-24 at 9.35.20 AM.png

 

Once I confirm the date string exists, I extract it and store it in the field "extractedDate" using the smart value

"{{issue.description.match(".*Effective date: ([0-9]{0,2}.[0-9]{0,2}.[0-9]{2}).*")}}"

 

Screen Shot 2023-08-24 at 9.35.29 AM.png

Then, I use another "create variable" action to convert the date into the proper string (I assume it was in the form of day/month/year initially) using the smart values as follows

 

"20{{extractedDate.subStringAfterLast(".")}}-{{extractedDate.subStringBeforeLast(".").subStringAfter(".")}}-{{extractedDate.subStringBefore(".")}}"

 

Screen Shot 2023-08-24 at 9.35.34 AM.png

 

Finally we set the duedate to the "convertedDate" variable we created in the step before. I confirmed this process worked on my instance! I was able to take the string

 

"How would I go about getting a date from a Jira issue description (some of our issues always have the text "Effective date: 01.07.23") and set this date in a custom field "Due Date"" and set the due date to July 1st 2023.

Oleksandr Tymofyeyev
Contributor
August 25, 2023

Thank you so much for this! I will try recreating this.

Have a great day!

Regards,
Alex

Oleksandr Tymofyeyev
Contributor
August 29, 2023

Hello @Kian Stack Mumo Systems 

Sadly, that didn't work.

I've modified that to

{{issue.description}} contains regex .*Effective date: ([0-9]{4})-([0-9]{2})-([0-9]{2}).*

and I get "The following issues did not match the condition" while the description has

Type of change: Intern
Type of contract: Intern
Effective date: 2023-08-28

 

Could you help assist us further?

Suggest an answer

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

Atlassian Community Events