Automation: Add a Jira Group to email if IF/ELSE is unavailable in related issues branch?
Asked by Casey Gould:

I know what I want to do, and I know how I would do it, but as far as I can tell, "IF/ELSE" isn't an option when under a branch (Parent issue).

This automation:

If a story moves to In Progress AND conditions are met, move the parent to In Progress as well, and send an email which contains a lot of field details about the parent.

Today, that email gets sent to the initiator and 2 custom user fields, which works great. Now I want to add one of three manager groups to the email as well, based on which of 3 filters the Parent is in.

Options I see:

1. Do the logic on which management group should be notified before branching to the parent, save the appropriate group name to a variable, add that variable to the CC field on the email. **Would this even work?**
2. Save all the fields I want from the parent to variables and run the logic afterwards (please no).
3. Create and maintain three separate instances of this automation, one per manager group.
4. Jira lets us use IF/ELSE underneath a related issue branch.

Any suggestions?


Answers:
author: Bill Sheboy
body: Hi [@Casey Gould](/t5/user/viewprofilepage/user-id/4987051)

You are correct: currently, an if / else condition cannot be used within a branch.

Sometimes this need can be solved by inverting the cases: use if / else, and put the branches inside of each case.

That may not been needed for your scenario. For your specific questions / options:

#1) Yes, you could use variables to select the users into a variable, and then use that in the email addressees. The "trick" is to ensure the values are split into separate values, or joined with semicolons.

#2) Although what you describe is possible, it is likely not needed. If the email content is conditional, perhaps use the inline conditional logic to help: <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/>

#3) Please see above for other options, as having three versions of the automation rule will create maintenance problems for your team(s).

#4) As already noted, this is not possible. *Please note well: there was a quirky behavior (i.e., defect) in the past where the rule editor allowed dragging such conditions inside of branches. As that behavior is likely a defect I suggest not using it or expecting it to work.*

Kind regards,  
Bill

comments: author: Casey Gould
body: Hi Bill, Thanks for confirming 4 is not an option (and I'm not just missing something in the updated UI). The inversion aspect is interesting - I wonder if I would be able to do the project check logic I need on the Parent field of the trigger story before going into the Parent branch. I'll try that next.


author: Trudy Claspill
body: Hello [@Casey Gould](/t5/user/viewprofilepage/user-id/4987051)

#4 is not an option. You are correct that the IF/ELSE option is not available under a Branch.

Can you clarify this point?
> based on which of 3 filters the Parent is in.

Exactly what condition are you trying to apply here to determine the group to whom the email should be sent?

One alternate option I can think of is to create a rule just for that evaluation and sending of email. Have that new rule use the Incoming Webhook trigger. The trigger that rule from within the branch of the first rule using a Send Web Request action. I haven't tried to do that myself, but I have seen it done.

comments: author: Casey Gould
body: Hi Trudy,

I need this automation to apply to \~20 projects. I currently have 3 filters set up to group those projects by essentially who the bosses are in a reusable way. So this is triggered on a story, then based on the project of the parent epic (which is often different), I need to include one of three sets of bosses.

Thanks!

*** ** * ** ***

ex: Projects A-F

notify group X for filter X: project in (A, B)

notify group Y for filter Y: project in (C,D)

notify group Z for filter Z: project in (E, F)


Tags: automation

cloud

cloud-automation

jira-cloud