Automatically reassign issues of agents who are on vacation with user properties
プラットフォームについて: Cloud のみ - この記事は クラウド プラットフォームのアトラシアン製品に適用されます。
要約
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 does not use the user properties but just the date custom fields Automatically reassign issues of agents who are on vacation
環境
Jira service management cloud - Automation
ソリューション
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. For this kb article, we 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 and this information is then updated in a user entity property that can be accessed by automation. If you don't want to use user properties, there is another workaround that just uses the date custom field Automatically reassign issues of agents who are on vacation.
Please note that these user properties are a type of entity property accessed using automation and REST API designed for integrations and apps to store per-user data and settings. These properties are different from the other user properties created and maintained in Jira.
Now to achieve this we need 4 automation rules:
- Rule to update user properties with vacation days
- 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 update user properties with vacation days
Before creating the rule, decide on the user property key name to be used to mark vacation days for all the users, for this kb the user properties are LeaveStart and LeaveEnd.
Please create an automaton rule with the below configuration:
- Add a scheduled trigger to run every day before the working hour starts to make sure all the leaves marked on Jira issues are copied from the date custom field to the user properties
Enable the option Run a JQL search and execute actions for each issue in the query and add the following JQL:
project = "PKEY" AND "Leave start" is not empty and "Leave end" is not empty and resolution = "Unresolved"
Add action Set entity property to set the LeaveStart and LeaveEnd properties using the Jira date custom fields
Entity Type: User
Select user: Issue Assignee
PropertyKey: LeaveStart{ "value": "{{issue.Leave start.jiraDate}}" }
.- Clear the Leave start and Leave end Jira custom fields using the Edit issue action so that the rule doesn't run for them again
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 Branch rule / related issues, choose the Type of related issues as JQL, and add the following JQL:
project = "PKEY" AND resolution = "Unresolved" and Assignee is not empty
- Within the branch, add the Advanced compare condition to check if the assignee's vacation has started:
{{assignee.properties.LeaveStart.value.toDate.jiraDate}} equals {{now.jiraDate}} - 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={{assignee.accountId}}
HTTP method: DELETE
Headers
Authorization: Basic "email:API Token"
ヒント
There is a more efficient way to achieve this by making the user properties LeaveStart and LeaveEnd searchable in JQL, refer to the steps here Making searchable entity properties
Once done, refer to the same rule with the same name from the other workaround but with the below JQL in LookupIssues action:
project = "PKEY" AND resolution = "Unresolved" and Assignee is not empty and assignee.property["LeaveStart"] = now()
Rule to automatically reassign all the issues owned by agents who are not part of the group Working Agents
Refer to the same rule with the same name from the other workaround.
Rule to add agent back to the group Working Agents when the leave ends
Refer to the same rule with the same name from the other workaround.
Contact Atlassian support if you have any questions.