Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can functions be called on variables having smart value

Shruti Shrivastava December 19, 2023

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.

1 answer

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.
December 19, 2023

Hi @Shruti Shrivastava 

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

Shruti Shrivastava December 20, 2023

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. 

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.
December 20, 2023

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:

capture 1.PNG

capture 2.PNG

Shruti Shrivastava December 21, 2023

@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?

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.
December 21, 2023

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.

Suggest an answer

Log in or Sign up to answer