If I want to add 20 percent to a custom field, what is the proper syntax to do this using variables?
variable name = valueA
smart value = {{#=}}{{customfield1}} + {{customfield2}}{{/}}
variable name = var1
smart value = {{#=}}{{valueA}} * .20{{/}}
edit issue and assign value to it fieldB
{{#=}}{{valueA}} + {{var1}}{{/}}
The value in fieldB is not what I would expect. Is there something wrong with the syntax of the expressions?
For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected. Those will provide context for the community to offer ideas. Thanks!
Until we see those...
Let's assume your original customfield1 and customfield2 are both numeric. If so, your expression could use an inline math expression like this:
{{issue.customfield1.plus(issue.customfield2).multiply(1.2)}}
If your fields are not numeric, what type are they?
Have you tried writing the values to the audit log to confirm they contain what you expect before editing the issue field, "fieldB"?
Kind regards,
Bill
This works great what you provided. I used this approach for some other rules I created. I did not see the syntax you noted using "plus" or "multiply" in the formula before. That is good to know for future use. Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn that helped!
There are at least three math expression formats I know of for rules. Learning these can help when operations do not seem to work as expected.
For some list and dynamic fields, occasionally the values need to be stored in a Created Variable smart value first, and then used in the math expression.
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.