Hi Guys,
Need your help in setting up one automation rule.
I have three dropdown field A, B and C and one Number field D.
All three dropdown field have options Yes and No
If A field value is Yes and B,C value is No then automation should set value of D to 1
If A field value is Yes and B is Yes and C is No, then Automation should set value of D to 2
Yes = 1
No = 0
Kindly help me with smart expression.
I have tested this :
{{#if(equals(issue.customfield_10321.value,issue.customfield_10322.value,issue.customfield_10323.value))}}3{{/}}
But it's not working.
Kindly suggest. What would be correct expression or what would be best approach to setup this automation.
There are 8 combinations.
Hi @Vikrant Yadav ,
you can create a variable where you simply concatenate all dropdown values and then write if conditions to compare the variable with conditions like "000", "001", "010" etc.
Hi @Max - Swift Checklist Dev Thanks for your response!
This automation rule is easier to implement. Let me give it a try. I can use single variable for all single select list field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Max - Swift Checklist Dev Thanks a lot for your help!
I created a flow using variable and it's working fine.
We can apply two condition without separating a two condition using space or comma ?
{{#if(equals(fieldValues, "YesYesYes"))}}3{{/}}
{{#if(equals(fieldValues, "YesYesNo"))}}2{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vikrant Yadav ,
I didn't quite understand your question. Could you please provide more details?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First thing, as you appear to have multiple values to test, I recommend using a Lookup Table where the row keys are the concatenated values of the three fields and the row values are the desired value of field D. For example, a row could be key= YesYesNo with a value= 2. Or better still, the key could be explicit: key= A:Yes, B:Yes, C:No
Or, create a Karnaugh map to identify and reduce the number of cases from 8, when possible.
Regardless of those ideas...
What are the types of your A, B, and C fields: single-select option, or something else?
Which format of conditional are you trying to use as what you show matches neither of these:
{{#if(some condition)}}value when True{{/}}
{{if(some condition, value when True, value when False)}}
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy Thanks for your help!
I never created a lookup table.
For Key do I need to use Smart value ( {{issue.customfield_10321}} ) to get single select field value or i put YesYesNo and value 2 , Key : YesYesYes and Value 3
and then apply a condition. In Condition, I need to get custom fields value.
What would be the condition when all value are Yes ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You would either need to use the and() function to combine values or concatenate them, as I noted with the lookup tables. (One advantage of the lookup table is ease of maintenance for this scenario's complexity.)
To use the lookup table approach, list each of the combinations needed, and then test the result with get() on the concatenated values. For example, with some made up values:
To use the and() function instead, two would be needed to create the test, as there is a limitation where the function only works with two values.
{{#if(and(first condition, and(second condition, third condition)))}}value when True{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy Lookup table method is also easy to implement and manage.
I am using lookup table for this rule. As i have 32 combinations.
Thanks a lot, Bill for helping me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Vikrant Yadav
Is there a reason you are not using the IF or ELSE condition construct for this in your Automation rule?
With that construct you can use multiple Smart Value conditions at once, using the AND or OR logical evaluator across them:
- If A field value is Yes and B,C value is No
... then use an Edit Issue action to set the field
Then add Else-if for the next combination, and so on for each combination.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Trudy Claspill Yeah, I can use simple if/else but combination of If/else is 32 in my case. Means 31 else statement i need to add in automation. It will become very long automation, that's why i an thinking to do it via smartvalue if/esle
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!
Join an Atlassian Community Event!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.