It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Using Behaviours to restrict issue type selection for project role

Judith Becker Nov 28, 2017

We use a behaviours script to restrict the issue type selection for a specific project role.

For the restriction to one issue type the following script works perfectly:

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager

import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
def constantsManager = ComponentAccessor.getConstantsManager()
def queryIssueType = constantsManager.getAllIssueTypeObjects().find { it.name == "Feedback"}
def IssueType = getFieldById(ISSUE_TYPE)
IssueType.setFormValue(queryIssueType.id)

 

The question is: How to change the script for a restriction to TWO issue types???

1 answer

1 accepted

1 vote
Answer accepted
Jenna Davis Dec 07, 2017

Hello, 

What version of ScriptRunner are you currently using? 

There is a bug that may prevent you from being able to do this effecting newer versions.

Jenna

Judith Becker Dec 07, 2017

Hi Jenna,

we are using the version 5.2.2 of ScriptRunner.

Will there be a solution for the bug in the near future?

 

Thanks,

Judith

Jenna Davis Dec 07, 2017

I believe that bug will effect you then.

I'm afraid we don't have a set timeline for issues, so I cannot give you a good estimate.

Jenna

Mani Reddy May 17, 2018

@Judith Becker Try this approach.

import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()

issue.projectObject.key == 'AR' &&
(!groupManager.isUserInGroup(issue.reporter?.name, 'abc') &&
issue.issueType.name in 'Bug' ||'Story')

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

Webinar alert! An IT Admin's Guide to Securing Collaboration at Scale

Hello, Atlassian Community! My name is Dave Meyer and I'm a Principal Product Manager at Atlassian. I wanted to give this community a heads up about an upcoming Webinar that might be of interest...

188 views 2 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you