Hello Team,
We need this configuration for calculation for internal project.
Imagine we have two text fields, A and B. Using automation, we calculate the sum of A and B and display the result in field C.
If field A has value and B does not have any value, field C should still display the Field A result.
How can I achieve this?
thanks you
I believe you would need an automation rule to fill out field C either on create or whenever the issue is updated.
You'll have to find the ID's for each custom field and then use the rule to fill out field C in the following format for the sum
{{#=}}{{issue.customfield_10000}} + {{issue.customfield_10001}}{{/}}
consider using asNumber conversion if your fields are strings not numbers
{{#=}}{{issue.customfield_10000.asNumber}} + {{issue.customfield_10001.asNumber}}{{/}}
Also you can have a whole bunch of if else in your automation - to validate the presence of values in your custom fields, or utilise conditional logic in your smart values:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Christopher Yen @Boris Zozoulia
Thank you for the response,
Following smart rules are functioning, but they require values in both fields to function.
I’m concerned that field C should remain visible if any one of the fields contains a value
how can I achieve?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As I have mentioned before:
Also, you can have a whole bunch of if else in your automation - to validate the presence of values in your custom fields, or utilise conditional logic in your smart value.
Take it back - the conditional logic in smart variables does not apply to setting fields, only send mail or comments though.
However try to use this
Where fieldA is your issue.customfiled_XXX and fieldB is your issue.customfield_YYY
Then you set your issue.customfield_ZZZ to use this smart value (represented in fieldC block above:
{{fieldA.asNumber.plus(fieldB.asNumber)}}
Jira Automation is using a moustache library under the hood, which is smart enough to behave like following tests:
1. fieldA = 1, fieldB = 2 then fieldC = 3
2. fieldA = 1, fieldB = {NULL or EMPTY} then fieldC = 1
3. fieldA = 1, fieldB = "some string" then fieldC = 1
4. fieldA = "some text", fieldB = "some more text" then fieldC = {EMPTY}
5. fieldA = {NULL or EMPTY} , fieldB = {NULL or EMPTY} , then fieldC = {EMPTY}
6. fieldA = 1, fieldB = {INVALID REFERENCE} then fieldC = 1
I believe the above is really what u are after.
Read the documentation mate:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/#Plus-Minus
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.
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.