Forums

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

Automation: Find the date difference between now and end of a sprint?

Michael Haywood
Contributor
July 22, 2024

Goal: Send a weekly automated message that says how many days are left in the sprint.

Attempt to Solve:

{{now.diff(issue.created).weeks}} works great as spelled out in the documentation.

However, I'm unable to get a result when I'm trying to access the sprint end date of an issue.

Below is my workflow

screenshot.png

I get a value for {{now}} and I get a value for {{lookupIssues.get(0).customfield_100016.endDate.jiraDateTime}}, but the 3rd audit log value that is doing the date diff is blank.

I tested doing {{now.diff(lookupIssues.get(0).created).weeks}} and it properly returned a value. 

So why can't the Sprint End Date be used for the date diff?

Or is there a better way to reach the goal?

2 answers

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.
July 22, 2024

Hi @Michael Haywood 

The sprint field in issues is a list field, containing 0-to-many values.  Please try getting the specific entry you need.

If your current sprint has the latest date, you may find the difference for an example issue in the lookup issues result with this:

{{now.diff(lookupIssues.first.sprint.endDate.max).days}}

For the first issue in the lookup result, this will check all possible assigned sprints for that issue, finding the one with the largest end date value, using it for the diff() with now.

Kind regards,
Bill

Michael Haywood
Contributor
July 23, 2024

Thanks @Bill Sheboy . That did the trick! Do you know, is there a way to exclude weekends from the date diff?

Like Bill Sheboy 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.
July 23, 2024

You may change the diff() units of measure from days to businessDayshttps://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-difference---

That will be Monday - Friday, and does not use any site or project settings regarding non-working days or saved holidays.

Like Michael Haywood likes this
Michael Haywood
Contributor
July 23, 2024

perfect, thank you! you solved my problems

0 votes
Michael Haywood
Contributor
July 23, 2024

Thanks @Bill Sheboy

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