Hello Atlassian Community,
I have an interesting goal to achieve and I need your help.
Goal
Using Jira automation, I want to add the correct fix version to a work item when the work item has a sprint added to it. The correct fix version is based on the sprint start and end dates being within the version's start date and release date.
My progress so far...
- The trigger is easy; when the work item has the sprint value added.
- The first action is for a web request to look up all versions within the Jira Space to return all version startDate and releaseDate against each version.
- I pulled the work item's sprint to get the sprint's startDate and endDate via smart values with date dot notations applied.
The problem
This is where I get to the problem, I have both sets of dates, I want to compare the sprint start dates with all the version start dates and determine which version start dates begin before or at the same time as the sprint start date. At the same time, I would need to do a similar comparison with the sprint endDate and all the remaining viable versions where the release dates is after or the same as the sprint's end date.
This is the Jira automation smart value logic I am using to no success and debugging with log actions (I am hoping it would return a version ID and name):
Version is:
{{#webResponse.body}}
{{#if(issue.customfield_10020.startDate.jiraDate.isAfter(startDate))}}
{{#if(issue.customfield_10020.endDate.jiraDate.isBefore(releaseDate))}}
{{name}} (ID: {{id}})
{{/}}
{{/}}
{{/webResponse.body}}
the webResponse.body is from the REST API endpoint I am calling. I have confirmed the JSON is coming through as expected.
customfield_10020 is the sprint field. As you can see, I have taken the dates and formatted them so they are the same format as the version startDate and releaseDate date formats.
Currently, the log action returns nothing and I'm out of ideas.
Any help would be gladly appreciated.
Thanks,
Danny