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
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
The reason why I have Look up + 2 variables creation, because I need multiple Lookups.
What I have for Variables creation, One:
And OneSize:
And Slack Message I need to compile:
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have tried your example and it does not work. I set a variable to either 1 or 0 and have this ..
on creation {{var}} = 0
if statement {{var}} is set to 1
after the if statement confirm {{var}} = 1
then {{#if(var.asNumber.gt(0))}}test{{/}}
nothing returns ..
thoughts on what i am doing wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.