Restrict groups on JSM approval field
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Purpose
'Group picker' fields can't have a restricted list of options. This means that if users are using a group picker field for the JSM approval process, this means users could engage the entire company depending on the group selected.
With this KB we are suggesting a solution where we'll prevent the issue from reaching the approval state with an invalid group on the approval field.
Background
We do have some open feature requests on our side to implement this requirement :
- JRACLOUD-61856 - Limit group picker to filter out desired groups
- JRACLOUD-11945 - Ability to add options to a multi user/group picker
Solution
- Confirm the Jira Misc Workflow Extension add-on is available on the site
Go to your project and click Project settings.
- Click Workflows and then Edit for the relevant workflow.
- Select the transition:
- In diagram mode, select the transition arrow.
- In text mode, select the transition's name from the Transitions (id) column.
***We recommend updating the transition that takes the issue to the approval status.
- Open the validators tab:
- In diagram mode, click Validators in the properties panel to show the triggers configured for the transition.
- In text mode, select the Validators tab.
- Click Add validator.
- Select Build-your-own (scripted) Validator (JMWE app) and click on Add.
- Add an expression to ensure the field is not pointing to the restricted groups. On my site the expressions looks like this: !!issue.customfield_10071 && issue.customfield_10071.name != "jira-software-users" && issue.customfield_10071.name != "jira-users"
***The transition to the status that requires approval will fail if the approval field has the groups jira-software-users or jira-users.
***The id of the custom field should be updated while implementing the solution on another site. - Enter a message so in case the transition fails the users know the problem is the selected group.
- Click on Add.
- Click on Publish Draft so the changes take effect.
We have a video that shows the steps taken for the configuration and how it impacts the issue workflow. Please check below: