Forums

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

Use Automation to Set Due Date Field

Isaac Sacolick December 23, 2020

I'm trying to set the dueDate field and not having much luck. 

Trigger - When an Issue is scheduled to a Sprint, part the Sprint name for date information and set the dueDate field.

The sprint name has the following convention

ProjID-Num MM-DD - MM-DD

Where the first MM-DD is the start date and the second is the end date of the sprint.

I have been using the following to set the date in the automation

{{issue.Sprint.name.substringAfterLast(" ").concat("-21").toDate("MM-dd-yy")}}

which is converting the date correctly, but the field is being set and remains null after the trigger runs. 

What am I missing?

1 answer

1 vote
Bill Sheboy
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.
December 23, 2020

Hi @Isaac Sacolick 

First, it may help if you post an image of your complete rule and the audit log for a rule execution so the community can comment.

Next, you may want to make the year section dynamic, extracting the year from {{now}}

{{now.jiraDate.left(4)}}

And then, try removing the toDate() expression and see if the rule can implicitly cast it correctly


Best regards,
Bill

Isaac Sacolick December 24, 2020

Thanks for the idea. The issue is when the sprint is an upcoming year, so using the now function without some logic doesn't work. There really isn't an easy way to address this in automations, so I am just going to add the year to the sprint name.

I was able to get it to work with the following change from

{{issue.Sprint.name.substringAfterLast(" ").concat("-21").toDate("MM-dd-yy")}}

to

{{issue.Sprint.name.substringAfterLast(" ").concat("-21").toDate("MM-dd-yy").jiraData}}

I am not sure if this is the most efficient expression, or why adding jiraDate solved the problem. The docs don't provide this direction at all (very frustrating) and I got the idea after seeinganother community question regarding automation an dates.

Bill Sheboy
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.
December 28, 2020

Hi Isaac,

How do you know if it will be in a next year versus the current one?  If you can determine that within the rule you could use an If/Else condition to set the date, and increment the year for {{now}} with the function plusYears(1)

If this year use {{now.jiraDate.left(4)}}

else use {{now.plusYears(1).jiraDate.left(4)}}

 

__Bill

Suggest an answer

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

Atlassian Community Events