Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Use one of the other isUserInGroup methods

Marc Jason Mutuc
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 8, 2018

I'm currently using the following script as a validator

import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
groupManager.isUserInGroup(issue.reporter?.name, 'Group1') || groupManager.isUserInGroup(issue.reporter?.name, 'Group2') || groupManager.isUserInGroup(issue.reporter?.name,'Group3')

And I'm getting that warning message. What should I change? Can't find the documentation for it.

2 answers

2 votes
Stefani Kaimakliotou February 12, 2019

Instead of groupManager.isUserInGroup(issue.reporter?.name,'Group3') try groupManager.isUserInGroup(reporter,'Group3') 

You may be asked to include def reporter = issue.getReporter() first.

0 votes
Sam Bartolome November 15, 2022

I think some parenthesis between the first definition and the end, so you delimit the expression 

 

import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.getGroupManager()

(groupManager.isUserInGroup(issue.reporter?.name, 'Group1') || groupManager.isUserInGroup(issue.reporter?.name, 'Group2') || groupManager.isUserInGroup(issue.reporter?.name,'Group3'))

Suggest an answer

Log in or Sign up to answer