Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Use automation to create a sub-task for each user that is added to a custom field.

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?

1 answer

1 accepted

1 vote
Answer accepted
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.
Nov 03, 2023

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

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.
Nov 13, 2023

Let's assume you have a single issue, and your multiple-select user field, additional reviewer.  To drive the advanced branch, try using:

  • smart value: {{issue.yourFieldName}}
  • name: varReviewer

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.

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. 

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.
Nov 14, 2023

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.

  • trigger: some trigger you are using...such as a change to the field
  • condition: check to confirm the field is not empty
  • advanced branch: over the reviewers in your field
    • related issues condition: check if there are no issues for that reviewer
    • action: create the subtask

 

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.

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:Screenshot 2023-11-15 160643.png

Like Bill Sheboy likes this
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.
Nov 15, 2023

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:

  • Related issues: JQL issues
  • Related issues JQL: assignee = "{{Reviewer.accountId}}" AND issueType = Sub-task AND parent = {{triggerIssue.key}}
  • Condition: Are not present

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.

Yes! This is it. My JQL syntax was just a bit off, but this worked. 

Thank you, Bill!

 

Posting for others to see:

Screenshot 2023-11-16 081938.png

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events