Using Behaviours to restrict issue type selection for project role

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

Accepted Answer
1 vote
Jenna Davis Community Champion 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

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 Community Champion 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

@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
Community showcase
Posted Oct 11, 2018 in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

3,549 views 6 6
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you