I'm trying to create an Automation rule that parses out future sprints based on a lookup. For some reason, using a For each isn't splitting the return into multiple values.
The basic idea is this:
project = TEST and sprint in futureSprints()
I expect the For each to run once for each unique sprint, but instead, it's running a single time with all of the sprints as one large payload.
I'm still able to find attributes within such as the various states of the sprints, but because they're all running at once I'm unable to affect them separately.
I added a log for ▶ {{state}} {{distinctSprint.id}} ◀ and you'll see in the audit that it's printing all of the states, then all of the IDs.
What am I missing? I have a similar rule using this method that has been working for months now and this current rule is making me think the old one is working despite a flaw in design.
Hi @Brock Jolet
Have any of the issues been in multiple sprints, such as carry-over from prior sprints?
If so, please consider {{lookupIssues.sprint.distinct}} is...
For example:
The distinct result will be: A, B, C, B and not what we would hope: A, B, C
The work-around for this scenario is to merge everything first, then split and distinct. One wrinkle is you want only future sprints, and so the filtering needs to be on "future" state before merging.
So if we first create a variable, named varSprintList with the expression using nested iterators:
{{#lookupIssues}}{{#sprint}}{{#if(equals(state,"future"))}}{{name}},{{/}}{{/}}{{/}}
I purposely left the trailing comma so we know exactly what is in the result text.
Then the distinct list can be found with this:
{{varSprintList.substringBeforeLast(",").split(",").distinct}}
If you need the sprint id values (or multiple attributes), rather than the names, please adjust accordingly.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Bill Sheboy ,
I've got it working, but I'm trying to add more functionality. Any idea why checking if the id matches a string doesn't work? I'm able to use state or name just fine. I've also been unable to convert the id to a string.
I would expect the following to print the name of the sprint if the id matches:
{{#lookupIssues}}{{#sprint}}{{#if(equals(id,"1239"))}}{{name}},{{/}}{{/}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try using the format() function: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/#format-input-
Perhaps like this:
{{#lookupIssues}}{{#sprint}}{{#if(equals(id.format("#"),"1239"))}}{{name}},{{/}}{{/}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.