Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Using Smart Variables as function parameters in automations - does not work


Trying to figure out how to pass in smart variable value when defining another smart variable referencing some function parameter. 

For example:
I have an issue with 10 comments.

Given  smart variable:

commentNumber = 5

How to extract this comment from {{issue.comments}}?

I have tried creating smart variable with value

{{issue.comments.get(commentNumber)}} no data is returned

I have also tried {{issue.comments.get({{commentNumber}})}}

But automation returns an error in execution


The example above is somewhat arbitrary, and I do not need to hardcode comment Number, since it is calculated dynamically.


there is actually a Bug Report on this:

2 answers

1 accepted

Hmm, it appears, by using issue entity properties, list elements can be extracted properly!

Create smart variable:
Variable name: commentNumber
Variable value: 5

Set entity property for issue:
property name: prop_commentNumber
property value (JSON):

{"val": {{commentNumber}} }

Log action:


Is it the best approach at this moment, and there is a bug in accessing list elements via smart variable values?

I was really hopeful to use this workaround for a similar issue, but my variable is a date and doesn't seem to translate.

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.
Sep 20, 2021

Hi @Brock Jolet 

Have you tried changing the date into one of the other formats before storing it?  You can then convert it back with toDate later.

Kind regards,

@Boris Zozoulia thank you so much for this!!  I was able to use it to work around not being able to loop through smartVariable lists to create issue content.  I wanted to share how I used it.  Obviously this workaround only works for short lists and where the two lists are the same length. 

Note: the lists are created using {{ issue.description.match("(capture_group)")}} and therefore vary in length depending on the number of matches.

Create smart variables:
Variable name: List1
Variable smartValue: {{ description.match("(capture_group1)") }}
Variable value: 12345, 22345, 33345

Variable name: List2
Variable smartValue: {{ description.match("(capture_group2)") }}
Variable value: xxxxx, yyyyy, zzzzz

Set entity property for issue:
Property name: Lists
Property value (JSON):
"ListOne": [ {{ List1 }} ],
"ListTwo": [ {{ List2 }} ]

Create another smart variable:
Variable name: countOfItems
Variable smartValue: {{ }}
Variable value: 3

Create actions based on list length:
IF {{countOfItems}} == 1
THEN add new comment: 
List1 Val: {{ properties.Lists.ListOne.get(0) }} List2 Val: {{ properties.Lists.ListTwo.get(0) }}
List1 Val: 12345 List2 Val: xxxxx

ELSE IF {{countOfItems}} == 2
THEN add new comment
List1 Val1: {{ properties.Lists.ListOne.get(0) }} List2 Val1: {{ properties.Lists.ListTwo.get(0) }} 
List1 Val2: {{ properties.Lists.ListOne.get(1) }} List2 Val2: {{ properties.Lists.ListTwo.get(1) }}
List1 Val1: 12345 List2 Val1: xxxxx
List1 Val2: 22345 List2 Val2: yyyyy

and so on....

Oh, I found a confirmation of a similar issue by another user.

It appears you cannot use smart variable values in passing in as function arguments when constructing other smart variables.

Thanks, @Julien Robert for confirming my finding (half a year ago ;)

@John Funk @Bill Sheboy

That is really a limitation

@Bill Sheboy Have just discovered you mentioned this bug previously:

Greetings, community!  Quick tip: created variables do not appear to work as inputs to functions, such as:

{{issue.description.replace(myVariable, "my new text")}}

What happens is the variable evaluates to null and collapses the function, even when you add null handling.  Maybe there is something up with the typing of the created variables which does not allow them to be resolved.  I am submitting a defect for this so Atlassian has visibility of the issue.

Mind sharing the jira bug report on this ?

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.
Sep 16, 2021

Hi @Boris Zozoulia 

Thanks for that work-around with entity properties!  Now just got remember to keep those cleaned up when used as temps.  :^)

You will not be able to see the defect my company submitted, but here are the public backlog ones for it:

Kind regards,

Like Boris Zozoulia likes this

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events