set due date of an issue based on the sprint end date

Kelli Frattini-Adams
Contributor
August 12, 2021

I want to set the Due Date field with the sprint end date. I have script runner but am quite new to it. I tried this with automation but it doesn't update when the sprint is changed. Can someone help me on how to do this with script runner.

 

I want the due date updated each time the sprint changes so keep only the end date of the "Current" sprint not the first sprint it was in.

1 answer

1 accepted

0 votes
Answer accepted
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.
August 12, 2021

Hi @Kelli Frattini-Adams 

I do not have ScriptRunner installed so I cannot help with that.  But if you post your automation rule and describe what is not working the community may be able to help you improve it.  Thanks!

And, what do you mean by "each time the sprint changes"?  Do you mean the end date of the sprint is changing before it starts or while it is running?

For the first case, your automation rule could use the Sprint Started trigger to correctly change the date.  The second case sounds like a bigger problem (changing the date of a running sprint), although you could use the Sprint Completed trigger to set the date *after* the sprint finishes.

Best regards,
Bill

Kelli Frattini-Adams
Contributor
August 12, 2021

@Bill Sheboy The automation works, except when issues are not completed in a sprint and moved to a new sprint.

The old Sprint end date becomes obsolete however, the system will not overwrite the due date field with new sprint end date. Unfortunately, this happens a lot and is not a one off scenario. In doing some research this is a common issue - that the sprint end date will not update when sprint value is changed and everyone suggests script runner to resolve i.t


I've attached a picture of my automation.

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.
August 12, 2021

Kelli, I do not see your rule, so maybe try posting it again.

And the sprint end date is an attribute of the sprint, not of an issue.  If you are seeing that from an issue that means you are looking at a different sprint.  Using the sprint created or completed triggers can help as they focus you on the specific sprint you want.

Like Kelli Frattini-Adams likes this
Kelli Frattini-Adams
Contributor
August 12, 2021

@Bill Sheboy Trying to upload again. I'll take a look at the sprint triggers too.

Project-automation-JIRA (1).png

Like Arensa Prasta likes this
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.
August 12, 2021

Thanks for the image...and yup, it is not picking the sprint you necessarily want.  That is why the sprint triggers help.

And...if you do not have future sprints set up, and the current one always has the latest dates, you could use this with your current rule as "sprint" is a list of values: {{issue.sprint.endDate.max}}

Also, I see you are branching on the current issue.  That may not be needed unless you plan to have more logic after the branch.  Instead, it could be:

  • trigger: issue field changed for sprint
  • condition: status is not Done, Obsolete, Released, Duplicate  (?? Should this also include Backlog??)
  • condition: sprint is not empty
  • action: edit issue to set due date to {{issue.sprint.endDate.max}}
  • action: add comment for {{issue.sprint.endDate.max.jiraDate}}
Florian Royer
Contributor
January 26, 2023

@Bill Sheboy , hi
You said "if you do not have future sprints set up".

In my case, I have past sprint and future sprints attached to a story.

How can I determine the max date among all the sprints linked?

Thanks for your precious help ;)

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.
January 27, 2023

Hi @Florian Royer 

When I wrote that post, I did not recall what happens accessing the sprint information of future sprints.  I recommend trying a manually triggered rule to test, writing this to the audit log:

{{issue.sprint.endDate.max}}

One big challenge with this approach: what do you do when an a future sprint is edited as there is no automation trigger to detect that event?

Kind regards,
Bill

Like Jon Platt likes this

Suggest an answer

Log in or Sign up to answer