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

Pick a new assignee each work week for a new ticket.

Harry Heathcote March 23, 2023

I have an automation run daily that act as a checklist for the team. With this currently it gets assigned to me and the others are added as participants to the ticket. 

It has now been said that this ticket needs to be assigned to a different person from the team each week. 

When testing I can have the ticket change assignee every time its created but that's daily not weekly so I need some automation to assign the ticket in a round-robin manner to someone from the team for the week then change the next week to a different team member. 

Any ideas for this would be helpful. 

2 answers

2 accepted

0 votes
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 27, 2023

Hi @Harry Heathcote - so I think I came up with something that works, although it is a little... complicated. (And ha, reading @Bill Sheboy's answer, using modulo of the week is the smart answer I was trying to come up with and failing. So I brute-forced it. But hey, everyone gets to learn about Project Entities and the new Lookup Tables feature! :-)

Rotation Rule

First off we have "Assignee Weekly Rotation". It takes advantage of Project Entity Properties to store a weeklyCounter (1 to X number of people on your team) and a weeklyAssignee (the accountId of whomever is the default assignee for the week).

Setup

Because we're using a scheduled rule, we have to specify a JQL query so Automation knows which Project we are creating these properties in.

Screen Shot 2023-03-25 at 12.49.23 AM.png

Ok, now that Automation knows what project we're working in, we can start editing entity properties for the project.

I check to see if the property has been created yet, and if so, I a little bit of maths to basically increment the "counter" every week until we hit the max number of team members (in my example 3), at which point we roll back to 1.

Screen Shot 2023-03-25 at 12.47.13 AM.png

The Else case covers initialization of the weeklyCounter property setting it to "1" if it was previously empty.

Ok now we're getting a little ahead of ourselves because I'm using a new feature that I don't think has been released yet - Lookup Tables! (What's the status on that @Simmo?)

Screen Shot 2023-03-25 at 1.06.23 AM.png

So what we have here is simply a mapping of your team members. Every week the counter rotates through the numbers, and in the next step, we will be using the lookup table toso a search for the week's default assignee's email to the the accountId (because that's what Automation needs to assign tickets).

Because of... latency, we do need to "Re-fetch issue data" before we go to the next step.

Unfortunately nothing is too easy with Automation, and there is not an internal action to lookup user accountIds by email. Luckily there is an API endpoint for that, and there's a way to use the "Web request" action to hit that API and get back the accountId:

Screen Shot 2023-03-25 at 1.05.54 AM.png

Now we've got the accountId, and it's just a matter of grabbing the accountId from the Web Request response and putting it into another project entity property that we're calling weeklyAssignee:

Screen Shot 2023-03-25 at 1.05.39 AM.png

Assignment Rule

OK! So now we have our weeklyAssignee as a project property! Now you think it'd be easy to just adjust your existing rule that creates an issue on a daily schedule to just have it set the assignee to be the smart value {{issue.project.properties.weeklyAssignee}}.

ALAS, because you're using a Scheduled Task to create a new issue, Automation doesn't actually "know" what issue or project you are in, and so it can't get that property. 

SO, I created a separate rule that triggers "When: Issue created". It's scoped to the same project where the entities are stored (and where you are creating the daily tickets). And it does a check based on Summary. You would want to add checks for any other parameters to ensure you are only assigning for the daily task.

Screen Shot 2023-03-25 at 1.13.05 AM.png

Final Notes

  • So you'll want to remove any auto-assignment from your existing rule, so it doesn't get assigned and then reassigned right away.
  • Also: while there might be a way to remove the assignee from the list of participants, I figure it's just one extra email the assignee will get, so maybe you just add everyone as participants to every task. 

Let's see... oh yeah, I used the Entity Property Tool for Jira to troubleshoot these rules, and it's really handy if something's not quite working and you want to take a peek a the values Automation has set without going through the API (although that works great for just viewing the properties:  https://YOURSITE.atlassian.net//rest/api/3/project/YOURPROJECT/properties)

Unfortunately leaving it on for everyone to see entity properties for issues, users, etc may be confusing so if you do install it for testing, you might want to go into its configuration and later turn off "Globally enabled". Also, unfortunately the "Personally enabled" setting appears to be broken, which is a bummer, because this would be a useful admin tool.

Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 27, 2023

Another option, If you're OpsGenie, is to setup a roster and make an API call to the who is on call endpoint to get their account ID. I'm doing that at the moment for one of my teams weekly rosters :)

0 votes
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.
March 26, 2023

Hi @Harry Heathcote 

The Assign Issue action has a round-robin option which appears to match what you ask: https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Assign-issue I have not used this one, and per the documentation the rule is somehow keeping tracking of assignments by this rule to a list of users (or a group, role, etc.).  This seems an easy thing to try first.

If this does not work for you, a more complicated approach might be to calculate the week-of-the-year number from {{now}}, mod that value by the number of people, and use that to index into the list of users to select one for assignment.

Kind regards,
Bill

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 27, 2023

Hey @Bill Sheboy - yeah Round-Robin works great, but I think the issue @Harry Heathcote was indicating is that it will rotate to the "next person in line" for every new issue, and Harry wants that to be the same person throughout the week.

I did think about mod before I wrote my horribly complicated solution, but couldn't wrap my head around it. Of course now in the light of day, it seems simple:

Assuming there are 3 team members, you just have to do a check if:

{{#=}}{{now.format("w").asNumber}} % 3{{/}}

equals 0, 1, or 2, and assign tickets accordingly.

I tested, and this works just fine:

Screen Shot 2023-03-27 at 10.55.30 AM.png

So then, @Harry Heathcote you would just need to remove the Auto-assignment from your current Daily rule that creates the checklist, and create a new rule like the one above.

It relies on the Daily checklist to have a consistent Issue Type and Summary so that it only does the automatic assignment for the daily checklist Task.

Anyways, yeah then we just do a little maths to get the week of the year and divide it by the number of team members, spitting out the remainder. Modulo operator - so powerful!

Harry Heathcote April 2, 2023

Thank you both @Bill Sheboy and @Darryl Lee for your assistance.

This is exactly what I was looking for and has helped immensely.

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events