Forums

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

{{lookupIssues.size}} repeats line but doesn't return the value in an email

Mashford, Reuben
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!
February 23, 2023

I'm using Automation on Jira Cloud to generate a Release email once a version is released. I've used Lookup Up Issues action using JQL against the version id, which works fine. I then log the value {{lookupIssues.size}} to confirm that this smart value returns a number, which it does in the audit log. I then want to use that value within the email content, but instead of returning the number of tickets being released, it duplicates the line of text for the amount of times of the smart value.

My code within the email is:

Hot Fix {{version.name}} included these items:

{{#lookupIssues}}
Total number of items released: {{lookupIssues.size}}
{{/lookupIssues}}

 

The output in the email is:

Hot Fix <version name. included these items:

Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:
Total number of items released:

The audit log value is: 14 and as you can see 14 rows are duplicated above.

 

The full email code is:

Hot Fix {{version.name}} included these items:

{{#lookupIssues}}
Total number of items released: {{lookupIssues.size}}
{{/lookupIssues}}

Stories
=======================================
<ul>
{{#lookupIssues}}
{{#if(equals(issuetype.name,"Story"))}}
<li><a href="{{url}}">{{key}}</a>: {{issuetype.name}}: {{summary}}</li>{{/}}
{{/lookupIssues}}
</ul>

Bugs
=======================================
<ul>
{{#lookupIssues}}
{{#if(equals(issuetype.name,"Bug"))}}
<li><a href="{{url}}">{{key}}</a>: {{issuetype.name}}: {{summary}}</li>{{/}}
{{/lookupIssues}}
</ul>

Tasks
=======================================
<ul>
{{#lookupIssues}}
{{#if(equals(issuetype.name,"Task"))}}
<li><a href="{{url}}">{{key}}</a>: {{issuetype.name}}: {{summary}}</li>{{/}}
{{/lookupIssues}}
</ul>

 

1 answer

1 accepted

1 vote
Answer accepted
Stefan Salzl
Community Champion
February 23, 2023

Hi @Mashford, Reuben  and welcome to the community

I guess you´d like to have this line only once. As {{#lookupIssues}} is iterating through the list of issues delivered by the JQL it repeats the line (as it tries to write anything per issue).

Try to just use the following line: 

Total number of items released: {{lookupIssues.size}}

 

Best
Stefan

Mashford, Reuben
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!
February 24, 2023

Hi @Stefan Salzl thanks for the welcome.

I did originally have the above in my code, but got an error around closing lookupissues tag, but I think that was related to the per issue type blocks, which is why they now all open and close the lookupissues tag, so probably inadvertently changed it thinking it was failing as the logs don't show resolved smart variables.

I did find it odd that the value wasn't written in my above scenario but instead the code previous was iterated that number of times.

I will let you know once I've been able to test again to confirm resolution.

Thanks.

Suggest an answer

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

Atlassian Community Events