Can functions be called on variables having smart value?
I have the following variables -
Variable = {{#=}} ROUND({{nPlusOneReady}} / {{averageVelocity}} * 100, 0) {{/}}
where nPlusOneReady = {{lookupIssues.Story Points.sum}}
averageVelocity = {{lookupIssues.Story Points.sum.divide(6).round}}
Now, I want to send an email report where I want to check if Variable1 is greater than equal to 80 then -> column <td> colour should be Green.
Something like this -
{{#if(Variable >= 80)}} <td> Value is - Variable </td> {{/}}
{{#=}}{{#if(Variable >= 80)}} <td> Value is - Variable </td> {{/}}{{/}}
Tried both but not working. Tried .gte(80) as well but that is also not wokring.
Do you mean the Created Variable action in rules?
If so, created variables are text type. To use them in a math expression which uses a condition like that they must be converted with asNumber. For example for your case:
{{#if(Variable.asNumber.gte(80))}} do something {{/}}
FYI: if you were only adding variables in the expression, conversion is implicit and so not needed.
Kind regards,
Bill
Hi @Bill Sheboy
Yes It is a smart value variable. I tried the solution you suggested but it is not working. I created another rule to just create a variable and test the same.
Rule details:
When: Scheduled (every 1 Days)
Then: Create variable {{test}}
test = 108
And: Add value to the audit Log {{test.asNumber}}
- This log is not displaying anything
It is not even giving any error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would you please post an image of the rule itself?
If you are are unable to do so, what do you mean by "test = 108"?
Here is what I see when I do that with Jira Cloud:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy My rule looks exactly the same, But I am on Data center. May be this functionality is not available in Data Center.
Is it possible for you to test it on DC?
Is there a way to find any work around for the same in DC?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do not have the Data Center version to test this.
Would you please post your entire rule, the actions, and the audit log details. Perhaps that will show something.
By the way...when I just checked the Server / Data Center documentation for smart values, I do not see the asNumber function supported: https://confluence.atlassian.com/automation/jira-smart-values-text-fields-993924863.html
And so perhaps all conversions of this type are implicit. Seeing your complete rule will help identify problems that could block the operations, or if the context of where the operation is happening prevents the conversion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.