I have automation that runs Lookup work items JQL query and sends result into slack
I want to split issues into chunks of 10 by adding some divider between them:
https://company.atlassian.net/browse/AST-XXXX [1] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [2] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [3] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [4] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [5] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [6] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [7] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [8] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [9] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [10] Update XXX to use YYY in ZZZ-------------------------https://company.atlassian.net/browse/AST-XXXX [11] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [12] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [13] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [14] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [15] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [16] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [17] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [18] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [19] Update XXX to use YYY in ZZZhttps://company.atlassian.net/browse/AST-XXXX [20] Update XXX to use YYY in ZZZ-------------------------https://company.atlassian.net/browse/AST-XXXX [21] Update XXX to use YYY in ZZZ
my problem is I cannot find condition that would work for index inside of #lookupIssues. here's my current code for send slack message step:
Ready for Refinement issues:
{{#lookupIssues}}
https://company.atlassian.net/browse/{{key}} [{{#=}}{{index}} + 1{{/}}] {{summary}}
{{/lookupIssues}}
Total: {{lookupIssues.size}}
then I tried to rely on index to get divider position. this outputs 1 and 0 properly:
{{#=}}{{index}} % 10 == 0 {{/}}
but it doesn't work in if condition:
{{#if(index % 10 == 0 )}}
====================
{{/}}
I tried to make simple condition to render just 1 divider - no output:
{{#if(index == 10)}}
====================
{{/}}
I tried to make simple condition that should be always true. this really confused me because I got no output again:
{{#if(index == 10 || index != 10)}}
====================
{{/}}
I also tried to use IF function but got "Unable to parse expression" error:
{{#=}}
IF(index % 10 = 0, "+++++", "------")
{{/}}
can anyone advice on how do I render something conditionally based on index? and how do I debug this properly? I look into Audit Log but it doesn't give a lot of information when there's no errors
Welcome to the community.
See this article from @Bill Sheboy , https://community.atlassian.com/forums/Jira-questions/Automation-JQL-and-iterating-with-an-index/qaq-p/2962250
It might provide you some guidance, or maybe Bill is willing to look at this request?
Hi @Serhii Okhotnik -- Welcome to the Atlassian Community!
Yes, and...to what @Marc -Devoteam- suggested:
The {{index}} smart value is a property only available when iterating a list, and it cannot be used in more complicated syntax, such as a conditional expression. (Indeed, only recently has Atlassian added the ability to use index with inline math expressions.)
The workaround Marc linked to may help your scenario...and it will take several variables to incrementally do this:
The reason this must be done incrementally is due to known defects in list iteration referencing the correct item's fields.
If you want more details on the how-to, please let me know.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.