Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,363,862
Community Members
 
Community Events
168
Community Groups

Automation Issue fields condition of parent object within a branch.

I'm running into an issue with an automation rule. What I'm trying to achieve is create an epic in another project (IT) with linked tasks based on values of a multi-select of a newly created epic in a different project (HR).

I've tried two different ways, here's screenshots of the settings right now and below a description of the other method I've tried.

Screenshot from 2021-11-12 15-48-20.pngScreenshot from 2021-11-12 15-50-41.png

 

As I'm sure you've noticed, the above only works if the all conditions of IT Hardware are selected. So, if an epic is created in HR and only "Docking Station" is selected, then the IT project will only get an epic without the linked task to provide the docking station.

I have tried putting the IT Hardware field condition within the branch. This resulted in none of the conditions being met since the branch was for "For Most recently created issue". I then changed the branch type to "Current Issue" which allowed the conditions to be met. However, that broke the "Due Date" and "Epic Link" values within the task. I was unable to link the task to the newly created IT epic since I was branching off of the HR epic for that task creation step.

 

Thank you in advance for any suggestions.

2 answers

1 accepted

0 votes
Answer accepted

I managed to work around this issue by putting the following automation rule in my IT project.

 

Screenshot from 2021-11-15 11-29-10.png

Also, in my HR project rule, I went with the branch on current issue rule.

 

Screenshot from 2021-11-15 11-34-43.png

Like Bill Sheboy likes this
1 vote
Mykenna Cepek Community Leader Nov 12, 2021

Try using the "If / else block" condition instead of an "Issue fields condition". That will ensure that execution continues even if the condition is not true.

Also, I'm noticing that your second "For most recently created issue" branch might misfire if the "Desk Phone" conditional causes a Task to be created. At that point, a new "most recently created issue" will be in effect.

To get around this, you'll want to put all your Task creation actions inside just one "For most recently created issue" branch. That should ensure they are created under the Epic created early in your rule.

Using pseudo-code, I envision your solution being more like this:

...
Action: Create Epic
Branch: For Most recently created issue
If/Else Condition: if IT Hardware contains Desk Phone
Then Action: Create Task
If/Else Condition: if IT Hardware contains Docking Station
Then Action: Create Task

Hi @Jeff Clay 

Yes, and...to what Mykenna suggests:

Are you trying to:

  1. create a task for each value in the multiselect fields in one rule, or
  2. do you only expect one value to be selected for the multiselect field?

If it is the first one, you are gonna need a longer rule and to save the created epic's key to help.  Otherwise only the first selected item in the list will be used (I think).  For example:

  • trigger: issue created in HR
  • condition: issue type is Employee onboarding
  • related issues condition: on your JQL
  • action: create the new epic in IT
  • action: create a variable to save the new IT epic's key
  • branch: on JQL to match the saved IT epic's key from the variable
    • condition: trigger issues IT Hardware has Phone
    • action: create task
  • branch: on JQL to match the saved IT epic's key from the variable
    • condition: trigger issues IT Hardware has Docking Station
    • action: create task
  • ... add more branch/condition/creates

Please note that this rule will run slower due to all of the branches.

Kind regards,
Bill

Mykenna Cepek Community Leader Nov 12, 2021

I believe the if/else condition does allow for checking if a multi-select field contains a value:

 

Screen Shot 2021-11-12 at 5.48.34 PM.png

Yes, I have a multi-select custom field called MultiSelectTest. We didn't have any multi-select fields, so I had to create one (months ago) to do some testing!

I've tried if/else but the problem with those is that after one rule matches the rest don't.

Mykenna Cepek Community Leader Nov 15, 2021

Hmmm. Perhaps the "Create Issue" action in the If/Else is altering what should be the "current issue" as the Epic specified in the branch. That sounds like a bug to me, but let's try to work around it...

Here is updated pseudocode that might get you going:

...
Action: Create Epic
Branch: For Most recently created issue
Action: Create variable DeskPhone set to 0
 Action: Create variable DockingStation set to 0
If/Else Condition: if IT Hardware contains Desk Phone
Then Action: Create variable DeskPhone set to 1
If/Else Condition: if IT Hardware contains Docking Station
Then Action: Create variable DockingStation set to 1
If/Else Condition: if {{DeskPhone}} is 1
Then Action: Create Task
If/Else Condition: if {{DockingStation}} is 1
Then Action: Create Task

This approach postpones the creation of the Tasks.

Important: With all these If/Else conditions, be sure NOT to nest them. You don't want this:

  If/Else Condition: if IT Hardware contains Desk Phone
If/Else Condition: if IT Hardware contains Docking Station
If/Else Condition: if {{DeskPhone}} is 1
If/Else Condition: if {{DockingStation}} is 1 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events