Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

To close a particular sub-task is user in project role

I've tried several examples that I've found for Scriptrunner but can't seem to get something to work. I want to set a validator on a sub-task with "Code review" in the summary and a user is in a project role. Some of the code I found has  underlyingIssue in it but my jira doesn't seem to recognize it. I've tried this IF:

if (issue.getSummary().equals("Code review") && (groupManager.isUserInGroup(currentUser, "Dev Lead")))


if (projectRoleManager.isUserInProjectRole(currentUser, devProjectRole, underlyingIssue.getProjectObject()))

I'm using Script Validator (Scriptrunner) and we are using Jira 8.1.0.


Thanks for your time!



1 answer

Hey @Jeff Foege ,

Can you try changing underlyingIssue.getProjectObject() to issue.getProjectObject() instead?

I configured the script in my Validator and was able to get the error to appear if the user is not in the Administrator role:-

import com.atlassian.jira.component.ComponentAccessor

def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)

def adminRole = projectRoleManager.getProjectRole('Administrators')

if(issue.getSummary().equals("Code Review") && projectRoleManager.isUserInProjectRole(currentUser, adminRole, issue.getProjectObject())) {
return true
} else {
return false

Hope this helps.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

467 views 19 23
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