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

How to use custom Variables in conditional logic

I need to use custom variables in conditional logic,

for example,

I create a variable called "Size" and make it "2"

Then I want to have next check: 

{{ #if(Size.gt(0))}}
Do something good
{{ /}}

Nevertheless, it doesnt seem to work at all, does it mean that current conditional logic do not support the custom variables? Or am I doing something wrong

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 14, 2022 • edited Sep 15, 2022

Hi @Vitali Fedarau and welcome to the community,

as far as I know variables are stored as string. Using ".asNumber"-method should solve the problem. See the documentation below:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#asNumber

 

I tested the following in my environment successfully (testNumber is my variable and set to 5):

{{#if(testNumber.asNumber.gt(4))}} test {{/}}

 

Best
Stefan

Hey, @Stefan Salzl thanks a lot for your answer!

Unfortunately, I have tried it already and it doesn't work in a more complicated logic,

Step by step:

My flow is next Screenshot 2022-09-18 at 19.33.33.png

The reason why I have Look up + 2 variables creation, because I need multiple Lookups.

What I have for Variables creation, One: Screenshot 2022-09-18 at 19.34.28.png

And OneSize: Screenshot 2022-09-18 at 19.35.02.png

And Slack Message I need to compile:

Screenshot 2022-09-18 at 19.36.09.png

So what I am doing here, I am creating 3 Lookups (you can see only One lookup+variables as I removed the rest for 1 specific showcase), after that I need to check the size of the lookup, if there is no issues within a specific epic link, then if condition should not run and the tickets + epic link summary should not show on the slack report.

So, I am building the One variable as the result of lookup formatting (which actually magically works), and building variable OneSize as size of the array (in my case it is 2, I have tested it). I have tried the asNumber stuff, but unfortunately, no matter what I do, this checkup gt(10) doesnt work. Each time it adds the section to the report, even number of tickets definitely lower than 10 (2<10 I believe). 

So maybe even with just saving integer as 2 it works, with saving the lookup size it doesn't seem to work. Am I loosing some other magic here?

TAGS
AUG Leaders

Atlassian Community Events