Hi community,
I feel like I'm complicating something that should be simple. I'm a Jira newbie, so please bear with me. Thanks in advance for your help.
I'm looking to clone a ticket based on a few restrictions. However, my (Global) automation rule (in our Jira Cloud server) is ballooning and I'm also stuck on how to get "clone if not exist in project" working.
In plain English, the automation should go like this:
- All issues EXCEPT issues in project ZZZ
- Assigned to users in GGG group
- AND issue does not already exist in project ZZZ (i.e. there isn't an issue with a similar summary in ZZZ)
- if issue type doesn't exist in project ZZZ --> clone issue + link issue + set issue type to [an existing issue type in project ZZZ]
- if reporter is not active --> set reporter to assignee
- Clone the issue to project ZZZ with all the same properties as the original issue
- Link the existing issue to the newly-cloned issue
Here is what I currently have set up, that is working without the duplication check:
[Trigger] When: Issue assigned
[User condition] Assignee is in GGG
[Issue fields condition] Project is not one of: ZZZ
[If] Issue Type is not one of: (Issue Types in ZZZ)
[---Then] Clone issue in ZZZ, set to an Issue Type in ZZZ, link issue
[Else-if] Reporter is not in: GGG
[---Then] Clone issue in ZZZ, set Reporter to Assignee, link issue
[Else-if, all match] Issue Type is not one of (Issue Types in ZZZ) AND Reporter is not in GGG
[---Then] Clone issue in ZZZ, set to an Issue Type in ZZZ, set Reporter to Assignee, link issue
[Else] Clone issue in ZZZ (keep all properties)
I find the automation is "ballooning", because what if BOTH the issue type doesn't exist and the reporter is not active? I need an "if" block for each individual case, but then I need an extra "else-if" block for when both of these cases are met at the same time.
I actually have a third "if" case: if the issue's status/workflow exists in ZZZ, then clone it; otherwise, clone to Backlog. But the amount of if-blocks will exponentially increase to match each case with each other..!? I was going to list out all the cases as an example (if 1 and 2 but not 3; if 1 and 3 but not 2...), but I feel incredibly dumb. I've given up on the if-blocks for the time being.
[EDIT: I thought I got the if-blocks working, but they don't! If I have an issue where both the assignee is deactivated and the issue type doesn't exist, then the issue doesn't get cloned properly. It works fine if the issue matches 1 of the cases, but it breaks when both cases are met...? I'll have to keep investigating...]
My main problem is that I can't seem to get the issue duplication check working. I know I should be using the JQL query project = "ZZZ" AND summary ~ "\"{{issue.summary}}\"" (or something along those lines anyway), but I started to get confused when I was testing this JQL in the search bar.
We don't have ScriptRunner installed. I wanted to see if we can get away without needing to install it, but if it makes life easier, then we can install it.
Please save me. I've been fighting with this automation rule for the day and I feel belittled.