Automation Rule to add due date to issue from text date in description

Marc Littlefair August 11, 2022

We have tickets coming through to our Jira Service Management from another system that sends us a date value in plain text. I'd like to create an automation to scrape that value and set the due date of the ticket to that date.

So far in my automation I've created a variable called StartDate with the smart value of {{issue.description.match("Start Date:\s(.*)")}}.

In the description of the ticket I have 

Start Date: 08/11/2022

For the purpose of debugging I have the automation add an internal comment to display the Smart Value which displays as 08/11/2022 which is correct but doesn't work when I try to update the Due Date to that.

In order to get that into the due date field I'm aware that I need to convert that Smart Value into an actual date that Jira understands but that is where I've got myself stuck, having tried to follow through instructions on https://confluence.atlassian.com/automation/working-with-dates-993924630.html to convert the text to a date the value is always blank and I don't know what I'm doing wrong.

Any help / guidance greatly appreciated!!

1 answer

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 11, 2022

Hi Marc - Welcome to the Atlassian Community!

I would probably try to stick the value into a single line text field instead of comments since those can be one to many and harder to deal with. Then the text convert might (hopefully) will be easier.

Can you try that and see what it does? You can just use the Summary field as a test if you want. And this code then for the date field update: 

{{issue.summary.toDate("yyyy MM dd")}}

Or whatever your format for dates is. 

And if that doesn't work, can you share your rule along with the audit log so we can see any error messages? 

Marc Littlefair August 19, 2022

Hi John, Thanks for the welcome!

Just found the time to get back to this. Thanks for you answer and apologies I didn't explain clearly that the comment is just for debugging to see what value has been scraped by the variables I've created.


The automation goes like this: First part is a variable to scrape the date out of the description.  Screenshot 2022-08-19 at 12.10.13.png

This bit works fine and I do get exactly what I am expecting.

The next part of the automation creates another variable which I was hoping would be the date in a converted form, however, this value doesn't ever generate and the audit log doesn't show any error.

Screenshot 2022-08-19 at 12.16.42.png

What I was wanting to do next is to take the newJoinerStartDate value created in the step above and edit the Due Date of the ticket.

Screenshot 2022-08-19 at 13.04.04.png

This doesn't work as the value for newJoinerStartDate is blank.  

The final part of the automation and the element that will be removed is to update the ticket with a comment showing me what values were created for each of the variables.

Screenshot 2022-08-19 at 13.06.11.pngThis updates my ticket to show this:

Screenshot 2022-08-19 at 13.06.56.pngThe initial value that is scraped from the ticket description is there and is correct, the problem seems to be when I try to convert that into a valid date format that the Due Date field will accept, sadly the audit log for this shows no errors which doesn't help direct me anywhere. 

Screenshot 2022-08-19 at 13.08.57.png

 

Any ideas / suggestions would be ace!

Allan N March 9, 2023

No ideas or suggestions, sorry - came here to say I am stuck at this point too.

Have tried multiple date formats using .toDate, .format, .jiraDate - none of which seem to work unfortunately!

Like Kasper Ramstafer likes this
Kasper Ramstafer January 16, 2024

Same! I'm hoping to follow this thread and maybe someone will have  solution.  I've tried those same date formats to no success.

Suggest an answer

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

Atlassian Community Events