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!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Automations: how to use a variable inside a smart value list.get()


I am trying to pull a random item out of an array from a json webhook request. I've got the following done:


  1. create variables rand, listSize, newIndex
  2. run the webhook request, delay for response
  3. (works) set rand to:
  4. (works) set listSize to:
  5. (works) set newIndex to:
    {{#=}}FLOOR({{listSize}} * {{rand}}){{/}}
  6. (works) verify this index is not a string by setting newIndex again to:
  7. (fails) obtain by the new index with:

Unfortunately, this doesn't work at all. I've tried variations like:



 When I just use a raw literal number, it works fine. e.g.,


Not really helpful if I'm building a random function, basically.


Am I missing some nuance about the syntax here? Thanks

2 answers

Has this been resolved? Im having the same problems

0 votes
Sam Harding
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Sep 22, 2020

Hi Eric,

Thank you for your patience waiting on an answer for your problem. We have been looking into it, and trying to find a solution for your use case. Unfortunately, the current implementation of custom variables only allows for storing of values as strings. So 'newIndex' in your rule is always evaluated as a string, regardless of its original type. This is a limitation we are aware of, and is something we are working towards solving. 

Within that limitation, I do not believe there is a way for you to do what you are wanting. I have raised this internally with the team, and we will hopefully be able to provide the functionality you are wanting in the near future.


Thanks for responding. I started to realize that and abandoned this technique, but even if there was a "JSON.parse()"-esque function that could be used to parse and obtain a value, it could be used inline in a way that doesn't require persisting it as an object.

For what it's worth, I made a naive version of this where I store a number of strings in variables and then used a random function to traverse through several conditionals to select a value.

Looking forward to seeing what you guys come up with for a better long term solution.

Like Sam Harding likes this

Hi @Sam Harding 
Is there any update on this limitation?
I ran into the similar situation where I have two separate lists with the same length and there is a need to get the item of the second list based on the current index of the first list. Hence I need a function where I get pass a variable in the get() function.


Have you tried the following?


Hi. Gordon.

It does not work either. By any reason the 'get' function only can be used with fixed numbers. I have the same issue.

Actually, in no function with numeric parameters (charAt, left, etc.) you can use a variable, even with 'asNumer' sufix.

Smartvalues is a real pain for developers.


Like Pieter Wouter Hartog likes this

Smartvalues is a real pain for developers.

There are few statements truer than this. 

The inconsistency in the conditions under which different methods/expressions operate, combined with the limitations on using different data structures...

It feels like every single possible permutation of expressions has to be tested individually to determine if it will be interpreted correctly.

Like # people like this

Just wasted a day of my life to get an list index to be stored inside a variable... only to find out, I can't set FixVersion with a certain version by accessing the list of versions with the help of my variable. 

I hate days like this 🙁


Failed to get value for issue.project.versions.get({{myindex: {{issue.project.versions.get({{myindex}})}}

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events