Forums

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

Automation Rule: Set User Picker Custom Field to a random user of a group

Tobias Appel May 29, 2024

I know that I can use automation rules to assign an issue automatically using round-robin for example to a random person of a group. However, we have a custom field (User Picker: Single User) that we want to set to a random user of a group and then send a notification to that person.

So I basically need the same functionality when "assigning" a user to the custom field

Screenshot 2024-05-29 at 14.23.09.png Screenshot 2024-05-29 at 14.23.23.png

Is this possible somehow? When I use automation rules to Update an issue field, I can only select a specific user but I can not choose from a group or list.

1 answer

1 accepted

2 votes
Answer accepted
Matthias Gaiser _K15t_
Community Champion
May 29, 2024 edited

Hi @Tobias Appel

unfortunately you can't use the same UI from Assigning an Issue, but you could build something like this manually. I'm thinking along these lines:

  • Define your list of users in a variable. You should specify the accountIDs there.
    Alternatively you could also call the REST API to get a list of users for a certain group.
  • Then you can get a random number with a math expression like this, you might need to round it to a full number.
    {{#=}}RANDOM() * {{userlist.size}}{{/}}
  • With this random number you can get the element from your user list and set it in your custom field.

What do you think about such a solution?

Cheers,
Matthias.

Tobias Appel May 30, 2024

I also thought about setting it via the REST API. That was the only solution I came up with.

I don't recognize the scripting language you use in that expression - is there a way to execute this directly within the automation rules or do I have to go with the REST API route?

Matthias Gaiser _K15t_
Community Champion
May 30, 2024

The syntax I used is a smart value. Smart values in Jira Automation can be used almost everywhere where you want to reference some content, apply conditions, or similar. Check out this documentation to lear about the different smart values.

Matthias Gaiser _K15t_
Community Champion
May 30, 2024

My idea with the REST API was that you could call the REST API via the Send web request automation action directly from your Automation rule. You could directly call the get users from group method to resolve the list of users for your group - and then apply the logic with the random number I described above.

Like • Tobias Appel likes this
Tobias Appel May 31, 2024

Amazing idea. I am going to try it out.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events