Forums

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

Split Lookup work items result into chunks by 10

Serhii Okhotnik
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 12, 2025

I have automation that runs Lookup work items JQL query and sends result into slack

Screenshot 2025-11-12 at 17.15.44.png

 

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 ZZZ
https://company.atlassian.net/browse/AST-XXXX [2] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [3] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [4] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [5] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [6] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [7] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [8] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [9] Update XXX to use YYY in ZZZ
https://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 ZZZ
https://company.atlassian.net/browse/AST-XXXX [12] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [13] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [14] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [15] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [16] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [17] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [18] Update XXX to use YYY in ZZZ
https://company.atlassian.net/browse/AST-XXXX [19] Update XXX to use YYY in ZZZ
https://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

1 answer

2 votes
Marc -Devoteam-
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.
November 12, 2025

Hi @Serhii Okhotnik 

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?

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.
November 12, 2025

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:

  1. flatten the list fields, plus the index, into a variable, with different delimiters between the fields and list items
  2. split #1 back into a list, and perform the modulo, storing the result in another variable
  3. split #2 back into a list, testing the module value for 0 to store a Boolean true / false, and storing that in another variable
  4. finally...split #3 back into a list, adding a conditional expression on the Boolean value as text to add the line breaks

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events