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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,644,521
Community Members
 
Community Events
196
Community Groups

Using list.get(x) with the value of x from another smart variable

I am trying to use a smart variable in the following way:

{{priorities.split(":").get(ppValue.asNumber)}}

priorities are created as a list proceeding this action, are are "Highest:High:Medium:Low:Lowest" .  ppValue is set to 1 earlier in the automation.

When I run, there is no value returned. 


When I reformat as the following:

{{priorities.split(":").get(1)}}

it returns "High" as expected.

 

Any thoughts on how to format this so the dynamic value can be passed in?

 

Thank you

3 answers

1 accepted

0 votes
Answer accepted

@Bill Sheboy 

I was unable to get the split to return a result.  

My final solution (included in a Create Variable smart action) was

{{#if(equals(ppValue,"1"))}}Highest{{/}}{{#if(equals(ppValue,"2"))}}High{{/}}{{#if(equals(ppValue,"3"))}}Medium{{/}}{{#if(equals(ppValue,"4"))}}Low{{/}}{{#if(equals(ppValue,"5"))}}Lowest{{/}}

Thanks for the feedback and help

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.
Oct 28, 2022

I am glad you got it to work, even if the get() after the split did not work.

I had an error in my post, as after split() the list is 0-based, not 1-based, so I will update that for anyone else who reads this.

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.
Oct 27, 2022 • edited

Hi @Ken Young 

In my experience, several of the functions in automation rules cannot take a created variable or smart value as a parameter.  I recall hitting this exact same symptom trying to solve another problem and found get() had this behavior/limitation.  Same symptom with smart value, list filtering.

The only work-around I found was to use a series of adjacent, conditional logic expressions...with the intent that one-and-only-one would evaluate to true.  This seemed to break the chain of smart value parsing which caused a null somewhere. 

Perhaps try this:

{{#if(equals(ppValue,1)}}{{priorities.split(":").get(1)}}{{/}}{{#if(equals(ppValue,2)}}{{priorities.split(":").get(2)}}{{/}}{{#if(equals(ppValue,3)}}{{priorities.split(":").get(3)}}{{/}}{{#if(equals(ppValue,4)}}{{priorities.split(":").get(4)}}{{/}}{{#if(equals(ppValue,5)}}{{priorities.split(":").get(5)}}{{/}}

 

Kind regards,
Bill

Thank you @Bill Sheboy for the suggestion.   I tried the code in a create variable action, but unfortunately is set a null action.  I will, however, try it in  "additional fields" when I am trying to create or updated an issue to see if I get a different result.   

 

If it worked in the create variable, this could be a really powerful way to extend automation.

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.
Oct 27, 2022 • edited Oct 28, 2022

Ooops, my bad; missing closing parentheses as I wrote that from memory.  Here is the fixed one:

{{#if(equals(ppValue,1))}}{{priorities.split(":").get(0)}}{{/}}{{#if(equals(ppValue,2))}}{{priorities.split(":").get(1)}}{{/}}{{#if(equals(ppValue,3))}}{{priorities.split(":").get(2)}}{{/}}{{#if(equals(ppValue,4))}}{{priorities.split(":").get(3)}}{{/}}{{#if(equals(ppValue,5))}}{{priorities.split(":").get(4)}}{{/}}

 

UPDATED: after the split() the list is 0-based and not 1-based.

Thanks for the feedback and help

0 votes
Curt Holley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 26, 2022

Hi @Ken Young 
What is it you are trying to achieve with this rule?

Perhaps if we could see all of the workings it would make it easier for us to assist.

Hi @Curt Holley .  I have an external system that is passing in information via email (formatted subject line) to Jira.  Priority can be  P1, P2, P3, P4, P5,  I am trying to convert to Jira's priorities aka: "Highest:High:Medium:Low:Lowest".   In this manner, I can set the priority of the created ticket to the correct priority using the "additional fields" in the edit issue action.

 

My other option is possibly to us the ID, but I am trying to determine if this mapping could be done,  

 

Thx

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events