Forums

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

{{^last}} not working in this code. Any idea why?

Troy Anderson
Contributor
August 21, 2025

Both of these are still printing a comma (, ) at the end of the list.  Any idea why??2025-08-21 18_38_39-Clipboard.png

2 answers

0 votes
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.
August 22, 2025

Hi @Troy Anderson 

Yes, and...to the suggestions from @Tuncay Senturk _Snapbytes_ with some adjustments...

For iteration which has filtering, I recommend not worrying about a trailing delimiter such as a comma; the complexity / risk of errors is not worth the trouble.

Instead, always add the delimiter and remove it later with text functions prior to a splitting back into a list.  Also, I recommend combining your iterators and conditional filtering.  For example:

  • action: create variable
    • name: varFilteredList
    • smart value:
{{#lookupIssues.issuelinks}}{{#if(and(equals(type.inward, "is cloned by"), inwardIssue.key.startsWith("SCR")))}}{{key}} - {{status.name}},{{/}}{{/}}
  • action: something that needs the list of values
{{varFilteredList.substringBeforeLast(",").split(",")}}

Given the number of filters, it may be better to just change the JQL for the lookup action to avoid this complexity. 

 

Finally, please note: once inside of a {{lookupIssues}} iterator, the issue prefix is not used, just the field smart values.

 

Kind regards,
Bill

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
August 22, 2025

Hi @Troy Anderson 

 

{{^last}} is evaluated against the original loop, not your filtered output.
Because you’re skipping items inside the loop with #if(...), the item you print last usually isn’t the actual last element of the collection. so {{^last}} is still true and you get a trailing comma.

Fix it by making the loop only contain the items you’ll print, then last will work

I am not sure if this will work but you can try something similar below

{{#issue.issuelinks.whereEquals("type.inward","is cloned by")
.whereStartsWith("issue.key","SCR")}}
{{issue.key}} - {{issue.status.name}}{{^last}}, {{/last}}
{{/issue.issuelinks.whereEquals("type.inward","is cloned by")
.whereStartsWith("issue.key","SCR")}}

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