Automatically reassign issues of agents who are on vacation
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
At this time, there is no direct way to reassign the issues when an agent is on vacation.
JSM has no native "agent on vacation" reassignment. The automation action Assign to a user in a defined list may still assign to an agent who is on leave. This article documents a workaround; the feature is tracked at JSDCLOUD-6191.
Solution
The workaround needs an entity that represents currently working agents. Choose one:
A group (the article's example uses a group called Working Agents).
A project role or a maintained list.
Mark each agent's leave using a date custom field (for example, Leave start). To achieve this, we need three automation rules, then add/remove agents from the working set based on those dates, and reassign accordingly.
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 the 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
Add a scheduled trigger to run every day before the working hours start
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 smart value below. 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
Add a scheduled trigger to run every day when the working hours start 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 the 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.
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:

Related articles
Contact Atlassian support if you have any questions.
Was this helpful?