How do I validate the user group of the assignee?

System administration

Project and portfolio management

Software development and DevOps

how-do-i-validate-the-user-group-of-the-assignee
Dan Tombs

Dan Tombs

Sep 16, 2021

Projects require many stakeholders to collaborate together. To make sure only the right people are marking tasks as done, you can automatically allow only specific groups in Jira to be able to edit an issue status.

Why is this helpful?

  • Prevent the wrong user from toggling the issue status to run your project smoothly.
  • Trigger the right error messages to give users visibility into the actions they’re allowed to make on issue statuses.  

Validate user group of the assignee

Grab this script:

Validating user group of the assignee script
 

Step-by-step tutorial

Here’s how you can validate whether or not the assignee is part of a specific user group. You’ll also see how to display an error message if the user doesn’t have a membership to that group.

  • Navigate to your Project Settings > Workflows panel.

Workflows panel in Jira

  • In your Workflows menu, click the Edit pencil icon.

Edit workflows.

  • Choose the transition status that you want to validate the user group of the assignee at.
  • Select Validators and click Add validator.

Adding validators in workflows

  • Select the SIL Validator option and click Add.

Adding SIL Validator

  • Choose to add a New Script and click on Next.

Adding scripts

  • Store the script under silprograms folder or any other folder of your choice and give it a descriptive name.
  • Paste the script into the editor and make sure you change the name of the user group in line 2 to match what you have in your instance.
  • In the Error field, you can decide what message you’d like Jira to display if the assignee is not part of the correct user group. 
  • Click the Save icon in the SIL Manager then click Finish.

Saving progress

  • Publish your workflow.

Publishing the worfklow
 

Make this script your own:

string userGroupToValidate= “jira-software“;

Replace the highlighted text with the group you’d like to check membership against. Some of the default Jira groups include site-admins, jira-administrators.

Not sure about the precise group names used in your Jira instance?

Visit your Administration panel. Head to Jira Administration > User management. On the left panel, click on Groups to see the full list of User Groups in your Jira instance. You can also double-check what users are part of each group.

TRY IT TODAY!
Dan Tombs

Dan Tombs

Dan Tombs is a Solution Architect at Appfire with hands-on experience across the Atlassian ecosystem since 2016. He’s worked with end customers, solution partners, and now helps teams thrive by shaping tools and processes around how they actually work and not the other way around. Dan champions automation as a path to scaling productivity, reducing context switching, and unlocking what teams do best.