I have an issue type that must be approved by a set of reviewers, before transitioning to the next status. Because the amount of reviewers varies for each individual issue, I have a lead reviewer designated as the assignee when in review status. All additional reviewers are identified in a single custom field, and are assigned as watchers. I need a way to have the lead reviewer know when the additional reviewers have reviewed and approved/denied the progression of the issue.
My thought is to have automation create a sub-task for each user that is added to the custom "additional reviewer" field. This can vary between 0 - 5 reviewers for each issue.
Unless there is a better solution, how would I write an automation rule that creates sub-tasks for a field that can have any number of users?
Hi @Brandon Fritcher -- Welcome to the Atlassian Community!
You could do this with an Advanced Branch, iterating over the users selected in your custom field: https://community.atlassian.com/t5/Automation-articles/Branching-over-smart-values-in-Jira-Automation/ba-p/1741935
To prevent timing problems in the rule, I suggest making this a manually triggered rule.
If instead you want this to fire whenever the user field is changed, that is a more complicated rule as it will need to check for the issues (to prevent duplication) and potentially remove ones if the user list changes.
Kind regards,
Bill
Hi @Bill Sheboy , thank you for your response.
I feel like this is the correct answer, but I don't know how exactly to implement this. At a high level, I understand the logic, but I do not know how to extract the users from the custom field and create a sub-task assigned to them. I am newer to Jira automation.
Thank you,
Brandon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let's assume you have a single issue, and your multiple-select user field, additional reviewer. To drive the advanced branch, try using:
Then inside of the branch, you may reference the fields as needed from the branch:
{{varReviewer.emailAddress}}
{{varReviewer.displayName}}
{{varReviewer.accountId}}
and so on...
Before starting, confirm the smart value using the how-to article below. Smart values are name, spacing, and case-sensitive, and so if the values are incorrect they will not work.
https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Please try writing a basic rule which just uses the branch to iterate over the field and writes each value to the audit log. Once that works, the other steps can be added.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, Bill. This is starting to work.
I am able to write a simple rule that will create a sub-task for each reviewer. However, if an additional reviewer is later added, and the rule is run again, duplicate sub-tasks are created for the previously existing reviewers. I assume I need to add in a condition that looks for existing sub-tasks, before creating new ones.
I'll keep plugging away, but I appreciate any additional guidance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, that is correct a condition will be needed to handle the case of adding a reviewer. If the person is assigned to the issue, that could be checked with a related issues condition (and JQL) or using Lookup Issues to look for matches.
A more difficult scenario is removing a reviewer from the list. There are currently defects with automation changelogs and list / multiple-select fields, and so I would recommend deleting those subtasks manually for now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am having a really hard time figuring out how to write a condition that will check if there is already a sub-task that is assigned to a user.
I can trigger the rule, and create a sub-task and assign for each user from the custom field. When I add a new user to that field and rerun the rule, I am not able to write it where it will only create a new sub-task for that individual user.
Here is the current basic rule, without the condition:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well done; you almost have the whole rule completed.
Please try adding a Related Issues condition for that test, inside the branch and before the action to create the sub-task. The idea is to check if there are no assigned sub-tasks for your {{Reviewer}} before proceeding.
The specifics to try are:
The JQL is the key part, ensuring there are no sub-tasks under the trigger issue story...which are assigned to one of the Reviewers the rule loops over.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes! This is it. My JQL syntax was just a bit off, but this worked.
Thank you, Bill!
Posting for others to see:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.