I am trying to create an automation using for each branch using a custom filed from discovery
Asked by Heba Salem:

I am trying to create an automation using for each branch using a custom filed. The automation catches that change but doesn't take the action of creating a task as required   
when I tried removing the branch it worked but that doesn't serve my need to create a task with different details based on the filed input   
![image.png](/t5/image/serverpage/image-id/342888i2C9371D16D4BA7FC/image-size/large?v=v2&px=999 "image.png")  

![image.png](/t5/image/serverpage/image-id/342891iEDB1952E96316C64/image-size/large?v=v2&px=999 "image.png")


Answers:
author: Marc - Devoteam
body: Hi [@Heba Salem](/t5/user/viewprofilepage/user-id/5398094)

Change your rule to use an IF/ESLE condition

In the IF use the JQL as in the first branch and the action, and in the ELSE the JQL from the 2nd branch and the related create action.

comments: author: Heba Salem
body: Hello [@Marc - Devoteam](/t5/user/viewprofilepage/user-id/3796976) I would normally use if else but actually I will include more than 2 cases


author: Marc - Devoteam
body: HI [@Heba Salem](/t5/user/viewprofilepage/user-id/5398094)

You can create multiple ELSE options, if/else is not bound to 2 actions.

But if you want to use branches, be aware they run in parallel, and use the JQL option,

Start the JQL with key = {{triggerissue.key}}

But best practice is IF/ELSE


author: Bill Sheboy
body: Hi [@Heba Salem](/t5/user/viewprofilepage/user-id/5398094)

Would you please explain the problem your rule is trying to solve? That is, "why do this?" Knowing that may help the community to offer better suggestions. Thank you!

Kind regards,  
Bill


author: Nikola Perisic
body: Hello [@Heba Salem](/t5/user/viewprofilepage/user-id/5398094)

I've replicated the same automation rule as yours, but I haven't included the additional branch. I've recommend to create two separate automation rules for Journey and Partners as well.

![Screenshot 2024-08-21 at 10.15.25.png](https://community.atlassian.com/t5/image/serverpage/image-id/342914i9C36EBC0C59BD191/image-size/large?v=v2&px=999 "Screenshot 2024-08-21 at 10.15.25.png")

Also for the Dependency Team trigger, have you checked for which operations it will trigger. It should be set to any operation,and also for a Change type see if its for any change that has been made.

As a final result:![Screenshot 2024-08-21 at 10.18.47.png](https://community.atlassian.com/t5/image/serverpage/image-id/342915i10A8E845D1E1824A/image-size/large?v=v2&px=999 "Screenshot 2024-08-21 at 10.18.47.png")

Additionally, you can use IF/ELSE condition, much simpler than the FOR branch.

comments: author: Heba Salem
body: Hello [@Nikola Perisic](/t5/user/viewprofilepage/user-id/5494176) thanks for ur detailed answer   
I have the filed update trigger for added value and for edit only can this be an issue ?  
I tried using it for all operations but instead it created issues for all discovery ideas that had the filed not empty   
I will also include more than 2 cases I was just testing


author: Nikola Perisic
body: Hello [@Heba Salem](/t5/user/viewprofilepage/user-id/5398094)

Try updating the trigger that applies to all of the operations and then test it again.


author: Heba Salem
body: I did still not working


author: Nikola Perisic
body: Make sure that the issue that you have created had either one of the checkboxes actually been checked as well, then validate it with the JQL that you have defined it. Make sure that you are not doing in the automation rule.


author: Heba Salem
body: I used if else after asking jira ai to create the flow for me it worked thanks a lot


Tags: cloud

jira-cloud