Automatically reassign issues of agents who are on vacation
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
At this time there is no direct way to reassign the issues when an agent is on vacation. Also automation action to assign with option A user in a defined list might assign issues to the users who are currently on vacation.
We are tracking the feature to provide this functionality here JSDCLOUD-6191 - Vacation of agents
While we wait for our product team to make a decision about this feature, this article explains a workaround to achieve this requirement using automation. We have another workaround that uses user properties Automatically reassign issues of agents who are on vacation with user properties
Environment
Jira service management cloud - Automation
Solution
Here is a workaround that could be used depending on the customer's current setup and preference.
We need to have an entity that acts as a source of truth for current working agents. The entity could be a group of users, a list, or a project role. Based on the vacation dates, this entity will be changed using automation. For this kb article let's use a group called "Working Agents".
Next, we will need to mark the vacation time of an agent. You could explore using the user entity property here that can be accessed by automation, refer to this Automatically reassign issues of agents who are on vacation with user properties. For this kb article let's use a date custom field to mark the vacation time, "Leave start" which will be set on any one of the issues owned by the agent.
Now to achieve this we need 3 automation rules:
- Rule to remove the agent from the group Working Agents when the leave starts
- Rule to automatically reassign all the issues owned by agents who are not part of the group Working Agents
- Rule to add agent back to the group Working Agents when the leave ends
Rule to remove the agent from the group Working Agents when the leave starts
Please create an automaton rule with the below configuration:
- Add a scheduled trigger to run every day before the working hour starts
Add a lookup action to find issues where the leave of an agent starts the same day
project = "<PKEY>" AND "Leave start" = now() and resolution = "Unresolved" and assignee is not EMPTY
The lookupIssue action is limited to 100 issues, if the JQL returns more than 100 issues here then lookupIssue will only refer to the first 100 issues.
Add an advanced branch with the below smart value. Distinct function returns all items in a given list, without duplicate items.
{{lookupIssues.assignee.distinct}}
- Within the Advanced branch that will run for a distinct list of assignees, add a send web request action to remove the user from the group Working Agents
Web request URL: https://<YourSite>.atlassian.net/rest/api/3/group/user?groupId=<GroupID>&accountId={{distinctAssignee}}
HTTP method: DELETE
Headers
Authorization: Basic "email:API Token"
Rule to automatically reassign all the issues owned by agents who are not part of the group Working Agents
Please create an automaton rule with the below configuration:
- Add a scheduled trigger to run every day when the working hour starts to find issues with agents who are not part of the group Working Agents
Enable the option Run a JQL search and execute actions for each issue in the query and add the following JQL:
assignee not in (membersOf("Working Agents")) and assignee is not empty and project = <PKEY>
- Disable the option Only include issues that have changed since the last time this rule executed
- Add Assign issue action to Assign these issues to users from the group Working Agents using one of the available methods:
- Add an Edit issue action to clear the Leave start field since the issues are now reassigned
Rule to add agent back to the group Working Agents when the leave ends
To add the agent back to the group Working Agents, you can keep a test ticket that can be used by agents to trigger an automation rule that adds them back to the group. Please create an automaton rule with the below configuration:
- Add the trigger Manual Trigger
Add a send web request action to add the user from the group Working Agents
Web request URL: https://<YourSite>.atlassian.net/rest/api/3/group/user?groupId=<GroupId>
HTTP method: POST
Headers:
Authorization: Basic "email:API Token"
Accept: application/json
Content-Type: application/json
Web request body: Custom data
Custom data:{ "accountId": "{{initiator.accountId}}" }
Once the agent is back, they can use the test ticket to mark themselves as back by triggering the rule from the Actions button:
Contact Atlassian support if you have any questions.