Jira automation - how to loop or repeat

VINCENT DUPONT
Contributor
February 27, 2025

Hello
I'd like to represent Progress as a sequence of unicode emojis, like ✅✅✅⬜⬜ to represent 60% of Done. This is easy to show in summaries in Jira and Confluence.

With Automation, I can count the number of tasks with status 'Done' and the total count of issues, so it is easy to calculate a unique % ratio, like 60%✅. 

However, i cannot see how to create something like a "Do while" or "For X" loop in side the Automation rule in order to printout my 5 caracters... or a Repeat() function for example

 

Any idea?

Thank you
Vincent

 

1 answer

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.
February 27, 2025

Hi @VINCENT DUPONT 

That may be done using the rightPad() text function with two parts:

  • a string of the checked box emoji representing "done" (relative to your 100%)
  • followed by a string of the unchecked box emoji for the remainder

When you already have number fields, those may be used as parameters to rightPad().  If instead the values are stored as Created Variables, numeric conversion is required.  And that is a bit trickier with text functions. 

For example:

  • ...some steps that store your box counts as varCheckedCount and varUncheckedCount
  • action:  Create Variable
    • name: varNull
    • value: {{null}}
  • something that needs your progress string:
{{varNull.rightPad(varNull.length().plus(varCheckedCount.asNumber), "✅").rightPad(varNull.length().plus(varUncheckedCount.asNumber).plus(varCheckedCount.asNumber), "⬜")}}

How that works:

  • Start with an empty string, varNull
  • Use rightPad to add on the checked boxes needed, but this requires special handling to convert the variable into a number for use with the text function
  • Use rightPad technique again to add on the unchecked boxes, noting that we want to increase the overall length and so both counts are added

I have used this same technique to create horizontal bar charts with rules.

 

To learn more about this technique, please see this article I wrote on using variables as numbers: https://community.atlassian.com/t5/Automation-articles/Automation-concepts-Using-Created-Variables-as-Numbers/ba-p/2953116

 

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