I have 3 custom field which stores the estimation for 3 work categories. They all are numeric fields.
Our Story point is the addition of all these 3 fields
I have this Math rule which works if 3 of these are valued
{{#=}} {{issue.customfield_12018}} + {{issue.customfield_12020}} + {{issue.customfield_12102}} {{/}}
But sometime not all 3 fields will be valued and then I get below error
Error rendering smart-values when executing this rule:Missing parameter(s) for operator +: + 0.25 +
Can someone help me to figure out how to handle Null
Hi Neetu - try this code which sets the value of the field to 0 first if it is missing a value:
{{#=}} {{issue.customfield_12018|0}} + {{issue.customfield_12020|0}} + {{issue.customfield_12102|0}} {{/}}
OMG.. John
Thank you so much.. it worked. I cant even thank you enough for making this work. I am super glad I didn't put a workaround.
Thanks
Neetu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great! I am glad that worked for you. :-)
Can you click on the Accept answer button above so we can close this one out? Thanks!
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.
This is exactly what I needed as well, thank you @John Funk !!! The "|0" is brilliant and will be really useful for number fields in the future !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great! Glad you found it useful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @John Funk
I have a question related to this. Can we perform 'division' action as well using smart values. I could not find anything in documents as well. But instead of + I used '/'
I tried the similar approach {{#=}} {{issue.customfield_1245|0}} / {{issue.customfield_5656|0}} {{/}}
I am getting the following error:
Missing parameter(s) for operator /: 125 /
where 125 is the value customfield_1245.
Any suggestion would be a great help.
Thank you in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Harsh - Not sure why that didn't work as that is the corrector operator. Though it sounds like it is not getting a value for customfield 5656. You could try doing a log action on that field or just update the field to have a 0 in it. You should always default number fields to 0 if you are planning on using them in automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @John Funk
Thanks for the update.
I updated the following rule with following input:
{{issue.customfield_1245|0}} = 125 / {{issue.customfield_5656|0}} = 5
I am expecting an answer of 25.
Option 1:
{{#=}}{{issue.customfield_1245|0}} / {{issue.customfield_5656|0}}{{/}}
Here I am getting the error:
Option 2:
{{#=}}{{issue.customfield_1245.value|0}} / {{issue.customfield_5656.value|0}}{{/}}
{{#=}}{{issue.customfield_1245.value}}/ {{issue.customfield_5656.value}}{{/}}
Here I get the following error
Option 4:
{{#=}}{{issue.customfield_1245}} / {{issue.customfield_5656}}{{/}}
Here I get the following error:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @John Funk
Issue resolved. I tried with other field and it did. Somehow JIRA was not able to take the value from the other field.
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great! Glad it is working!
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.