Hi,
I'm fairly new to Jira automations
I'm trying to set a variable based on the output of random() which i'll use later in a webhook.
The problem is that it only seems to evaluate the presence of the value rather than the value itself and always returns SEC (in the example below). using https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/ as a reference:
{{if(RANDOM().gt(0.5), "PRI", "SEC")}}
Am I mis-understanding how the if function works in jira?
Thanks
Hello @Dean Ayres
Your code seems OK, but let's try a different approach.
Create a variable and set it with the random value and then use conditional logic on the variable.
- Add an action Set Variable and set the variable with {{RANDOM()}}
- add another action and use conditional logic as below
{{#if(randomValue.gt(0.5))}}PRI{{else}}SEC{{/}}
I hope it helps
I've played about with this for a bit and fixed the value of randomValue to 0.8, but the output seems to be empty:
--
The audit log suggests the operation was a success
Even worse, if i commit {{RANDOM()}} to the smartvalue it also returns empty:
{{#=}}RANDOM(){{/}}
It looks like you're new here. Sign in or register to get started.