Forums

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

Can I use an OR in an automation to check for a change in multiple fields?

Sigrid Schoepel
Contributor
August 14, 2020

Can I set up a single automation rule that if either of two fields update that an action is taken? I have two fields that if either update need to calculate a value and repopulate a third field.

2 answers

1 accepted

0 votes
Answer accepted
Ste Wright
Community Champion
August 14, 2020

Hi @Sigrid Schoepel 

You can do this in one rule using either:

  • Condition: If/Else - this allows for two separate branches of conditions / actions, which operate independently of each other.
  • Branch: Current Issue - think of this as an extension of If/Else - it allows for any number of conditions / actions to be separate based on the same trigger.

If you need assistance putting this rule together - please provide the specifics for how you need the rule to operate, and I'll try to create some instructions for you :)

Ste

Sigrid Schoepel
Contributor
August 17, 2020

Thanks, because I'm new to the automation rules and it's just not working for me.

What I have:

Risk Score field with Pass/Fail, defaults to Fail

Severity field with 1-3 rating

Impact field with 1-5 rating

What I want is for Risk Score to:

Change to Pass if Severity is 1 for any Impact
Change to Pass if Severity is 2 and Impact is 1-3
Change to Pass if Severity is 3 and Impact is 1
Stay/Change to Fail if none of those are true (Severity 2/Impact 4-5, Severity 3/Impact 2-5)

 

My rule set up for a specific nextgen project:

When issue updated

If: matches / Severity equals 1 /Then Risk Score (edit issue field) is Pass

Else-if: all match / Severity equals 2 & Impact is one of 1, 2, 3 / Then Risk Score is Pass

Else-if: all match / Severity equals 3 & Impact equals 1 / Then Risk Score is Pass

Then Risk Score is Fail

 

I got errors but am not now but the thing still doesn't update the way I need it.

Sigrid Schoepel
Contributor
August 17, 2020

I did get it to work by making two rules, one for severity and one for impact. It is a little slow to update the Risk Score field. If you have a slicker solution, that would be great.

Ste Wright
Community Champion
August 17, 2020

Hi @Sigrid Schoepel 

So I built this out in a Next-Gen Project.

I separated each rule:

  1. If Severity = 1, Impact != NULL - PASS
  2. If Severity = 2, Impact = 1-3 - PASS
  3. If Severity = 3, Impact = 1 - PASS
  4. If Severity = 2, Impact = 4-5 - FAIL
  5. If Severity = 3, Impact = 2-5 - FAIL
  6. If either Severity = NULL OR Impact = NULL - Fail

I added Scenario 6, assuming that both fields need to be populated for the rules to function. You could remove this if it's not needed, removing Steps 17-19 below.

-----------------------

This is the rule:

  1. Trigger: Field Value Changed - fields: Severity, Impact
  2. Branch: Current Issue (type of related issues)
  3. Condition: JQL Condition - JQL - Severity = 1 AND Impact IS NOT EMPTY
  4. Action: Edit Issue - field: Risk = Pass
  5. Branch: Current Issue
  6. Condition: JQL Condition - JQL - Severity = 2 AND Impact IN (1,2,3)
  7. Action: Edit Issue - field: Risk = Pass
  8. Branch: Current Issue
  9. Condition: JQL Condition - JQL - Severity = 3 AND Impact = 1
  10. Action: Edit Issue - field: Risk = Pass
  11. Branch: Current Issue
  12. Condition: JQL Condition - JQL - Severity = 2 AND Impact IN (4,5)
  13. Action: Edit Issue - field: Risk = Fail
  14. Branch: Current Issue
  15. Condition: JQL Condition - JQL - Severity = 3 AND Impact IN (2,3,4,5)
  16. Action: Edit Issue - field: Risk = Fail
  17. Branch: Current Issue
  18. Condition: JQL Condition - JQL - Severity IS EMPTY OR Impact IS EMPTY
  19. Action: Edit Issue - field: Risk = Fail

-----------------------

It will take a few seconds to run at times - especially for the Branches near the bottom of the rule - but this should cover the scenarios listed above :)

Ste

Sigrid Schoepel
Contributor
August 18, 2020

Thank you so much! That was basically the "how to use branching" primer that I needed.

Like Ste Wright likes this
Ste Wright
Community Champion
August 18, 2020

No worries :)

Ste

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.
August 14, 2020

Hi @Sigrid Schoepel 

For the Field Value Changed trigger, have you tried to select multiple fields?  That should accomplish what you are asking.

https://support.atlassian.com/jira-software-cloud/docs/automation-triggers/#Automationtriggers-Fieldvaluechanged

 

Best regards,

Bill

Sigrid Schoepel
Contributor
August 14, 2020

I did but it only seems to trigger if both fields change.

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.
August 14, 2020

Hmmm...and thanks! I did not think it worked that way.  :^)

I suggest that you have two options then:

  • Create 2 rules (triggered on the different field changes) and copy the action part to each rule
  • Create 3 rules
    • 2 rules to catch the triggers for the field changes, and to cause a common condition that you can catch with a new trigger.  For example, you could clear the field you wanted to re-populate.
    • 1 rule (with the Details option set to be triggered by other rules), and this is where you do your third-field updates.  It is triggered by whatever condition you cause in the other two.

I have used both of these methods, and I recommend the 3-rule one.  It reduces the chance of errors by copying the "action" code, and it is scalable in case other future field changes need to trigger this action.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events