Forums

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

How to extract a date from the description of a work item?

Hans Polder _Devoteam_
Community Champion
July 16, 2025

Hi,

I need to extract a date from a Description field. Below is a test sample ticket where the date is located in the line 'Please execute before'. Its in the dd-mm-yyyy format.

Currently, I'm using the smart value {{issue.description.match("Please execute before ([^\\n\\r:]*)")}} but that also catches the period at the end of the line. I've tried a lot of regex variations provided by AI (I'm not that great with regex myself, so it's just monkey see-monkey do). But all of them seem to be way to complex for Automation to handle. It either provides no feedback (empty Log action) or returns all kinds of errors about the smart value being incorrect.

Any tips on how to approach this? In the end, I want to fill the Due date of the ticket with the date in the Description minus 21 days. I know there is some 'minusDays(21)' option, but to get there, I first need to have an actual date without the dot, in the right formatting.

Screenshot 2025-07-16 151416.png

Screenshot 2025-07-16 151558.png

Screenshot 2025-07-16 151534.png

Any help would be greatly appreciated!

Hans

2 answers

1 accepted

1 vote
Answer accepted
Gor Greyan
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.
July 16, 2025

Hi @Hans Polder _Devoteam_

Thanks for the interesting question.

I tried the following, and it works.
Firstl,y it extracts the date, then it changes the format, making it YYYY-MM-DD, then adding .toDate() conversion, and lastly minus 21 days.

{{issue.description.match("Please execute before ([0-9]{2}-[0-9]{2}-[0-9]{4})").replaceAll("([0-9]{2})-([0-9]{2})-([0-9]{4})", "$3-$2-$1").toDate.minusDays(21)}}

I put the provided regex directly into the Due Date, and it was successfully set.

Screenshot 2025-07-16 234108.png

Hans Polder _Devoteam_
Community Champion
July 17, 2025

Hi Gor, 

Wow, that's awesome! Thanks for your elaborate tests and reply. That worked perfectly. :)

Screenshot 2025-07-17 094454.png

 

Like # people like this
Gor Greyan
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.
July 17, 2025

Hi @Hans Polder _Devoteam_

You are Welcome. Happy that it worked.

Like Trudy Claspill likes this
1 vote
Trudy Claspill
Community Champion
July 16, 2025

Hello @Hans Polder _Devoteam_ 

Have you considered and tried substringBetween()?

{{issue.description.substringBetween("Please execute before ",".")}} 

Hans Polder _Devoteam_
Community Champion
July 17, 2025

Hi Trudy, 

Thanks for that elegant solution. I will keep that in mind for future 'text mining'. 

It exposed the date "29-09-2025" as expected without the dot.

Like Trudy Claspill likes this

Suggest an answer

Log in or Sign up to answer