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.
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! :-)
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).
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.
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.
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?)
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:
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:
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.
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.
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 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you both @Bill Sheboy and @Darryl Lee for your assistance.
This is exactly what I was looking for and has helped immensely.
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.