Forums

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

Jira Automation: Assign an issue to a value looping in a branch

Boyan Iliev
Contributor
October 24, 2025

Hi all,

 

I'm trying to assign newly created bugs, to the guy who worked on the feature. To do so, whenever a link between bug and feature is established, I check the feature assignee and try to apply it on the bug.

 

A feature might have passed several departments - dev, design, localization, etc. So I have a hidden custom field that picks up every single assignee. When the bug gets linked, I get its component and compare it to the groups each assignee is part of. If they match - I got my department and exact person who needs to be assigned.

Example:

  1. Bug component is "design"
  2. My assignees are "John, Tom, Jack":
    • John is in DEV team
    • Top is in ProductOwner team
    • Jack - in Design team
  3. I loop trough the assignees and compare if their ID appears in any of the groups members.
  4. Jack gets a match and I have his ID.
  5. How to assign this ID to the bug?

 

The issue is when I do advanced branching:

  • Smart value: {{issue.customfield_11747}} - my multiple assignee field
  • Value: loopAssignees

I manage to find the correct assignee, but I'm unable to assign him the bug. {{loopAssignees}} returns the user ID, but JIRA does not recognize it:

  • If I use "Assign work item" both with "Specific User"=>{{loopAssignees}} or "Smart Value"=> {{loopAssignees}}, I get "Issue was already assigned to current user", which is not the case as the bug is "Unassigned"
  • If I use "Edit work item" and JSON like the one below, I get "Issues edited successfully", but assignee is not changed
  • Both work If I pick a random item from the list, without branching - {{issue.customfield_11747.get(1)}}. I believe its the branching that causes my assignees to loose their "type".
{
"fields": {
"assignee": {
"id": "{{loopAssignees}}"
}
}
}

 

Any suggestions on how to achieve this? Both on the overall logic, or specifically on how to get JIRA to understand that {{loopAssignees}} is a user ID?

 

Thank you!

2 answers

1 vote
Marc - Devoteam
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.
October 24, 2025

Hi @Boyan Iliev 

Whenever you ask for help with an Automation Rule it will help us to help you if you provide:

1. what type of project is this (e.g., company-managed, team-managed, etc.), 

2. images that show your complete rule.

3. images showing the details of any relevant actions/conditions/branches.

4. images showing the Audit Log details for the rule execution.

5. Explain where the issue is.

These questions are not for not willing to help, but to have community members understand on how automation works.

Boyan Iliev
Contributor
October 24, 2025

Sure, its a company-managed project.

 

Here is the problematic part. Trying assignee outside this branch works. Within it - no.

 

J_Automate.png

 

Actually hardcoding last step also works, but I don't really want a hardcoded assignee:

{
"fields": {
"assignee": {
"id": "5c2dcac...."
}
}
}

 

Marc - Devoteam
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.
October 24, 2025

Hi @Boyan Iliev 

Have you confirmed your variable does not contain any leading / trailing spaces?

I think this might be the issue.

You could try the following option in the edit {{loopFEUsers.trim}}

 

Boyan Iliev
Contributor
October 24, 2025

I haven't, the result is different, but still no assignment:

J_Automate_2.png

 

Out of desperation I was trying .toString, .toJSONString etc etc as I thought JIRA does not recognize the variable value as string...nothing really worked - all returned empty result like the trimming. 

Boyan Iliev
Contributor
October 24, 2025

At some point I was trying to get the index of the item that matches my criteria and after that - outside the branch do something like {{issue.customfield_11747.get(<index>)}}, but this also was a dead end.

Marc - Devoteam
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.
October 27, 2025

Hi @Boyan Iliev 

Reviewing, you log actin shows that the variable contains a ";" behind the account ID, this needs to be removed in a way, as this is not part of the account ID.

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.
October 24, 2025

Hi @Boyan Iliev 

Would you please show images of your entire rule (in one continuous image) and the audit log details for the entire rule's execution?  Those may provide better context for this scenario.

Until we see those...

 

I recommend using the Assign User action with the accountId as a variable / smart value for this scenario rather than the edit.

And, I hypothesize you are either hardcoding the "team" list as Created Variables, or populating those team list variables by calling the REST API endpoints and checking groups.

If there is a variable with the list named {{feTeam}} and your {{issue.customfield_11747}} is a multiple-selection user field, you could find the overlapping values using methods described in this article I wrote to use the match() function with regular expressions rather than using the Advanced Branch:

https://community.atlassian.com/forums/Automation-articles/Automation-concepts-Find-Overlaps-Between-Lists/ba-p/3045704

 

And...please remember to add handling to check when no overlaps (i.e., matching user in the team) is found.

 

Kind regards,
Bill

Boyan Iliev
Contributor
October 24, 2025

This is the core logic, the rest are If/else statements to handle different components/teams, validate there are no assignees, finding out if the trigger is the bug or the task (was the link done in the task or in the bug) etc.

 

Yet, you are right that I've hardcoded a {{feTeam}} for simplicity. Moving forward I'll try to pick it up dynamically from the actual JIRA group (probably REST API ). Either way, match() sounds like worth a shot. I'll test and let you know.

 

I don't care about overlaps :) If 2 people from the same domain worked on it, assigning to either one is fine. And if I don't find an assignee, the bug will remain unassigned and picked up manually...by me.

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.
October 24, 2025

Perhaps I did not explain that well...

When you have a list of historical assignees and a list of people on a team, you can use the "overlaps" technique to find the person to whom you want to assign.  That would eliminate the looping and most of the conditional logic.

Boyan Iliev
Contributor
October 24, 2025

Yes, this makes sense. I did a quick test, but something is off in my setup.

 

Let me get back to it on Monday and I'll post results.

 

Worst case - I'll make a new custom field per department. It will be ugly, but simple :)

Boyan Iliev
Contributor
October 27, 2025

Hi @Bill Sheboy , I cant get it to work for some reason.

 

My assignee list is actually already "joined", wiht a separator of ", " as I define it like:
J_Automate_3.png

but when I do 

{{issue.customfield_11747.match(feTeam)}}

 

the result is empty. And I know that one of the people in the list match the above variable.

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.
October 27, 2025

You are trying to use the list of values as if it is a regular expression in the match() function , and it is not one.  Please take another look at that article I wrote for more details.

Assuming your variable named feTeam contains what you show, and is delimited by comma-space between values, you could create the expression with another variable:

  • action: create variable
    • name: varRegEx
    • value: ({{feTeam.split(", ").join("|")}})

Then to find any matches within the custom field, use this:

{{issue.customfield_11747.match(varRegEx)}}

 

Suggest an answer

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

Atlassian Community Events