Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Hide Security Level Field

clem
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.
June 14, 2016

Hi,

I'm trying to hide the security level field if Users are not in the security group.

I'm using the Behaviours script:

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.sal.api.user.UserManager
def securityField = getFieldByName("Security Level")

def userUtil = ComponentAccessor.getUserUtil()
log.error("Security Value:" + securityField.getValue())
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getUser()
if (!(userUtil.getGroupNamesForUser(currentUser.name).contains("security"))) {
log.error("User " + currentUser + " in security group")
securityField.setHidden(true)
}
else {
log.error("User " + currentUser + " not in security group")
securityField.setHidden(false)
}

 

However the line:

def securityField = getFieldByName("Security Level")

is always null.
How can I get the security level field?
Thanks,
Cynthia

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Michael Danielsson
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.
June 14, 2016

Hi,

you can try if 

def securityField = getFieldByName("level")

works.

 

Regards,

  Michael Danielsson

TAGS
AUG Leaders

Atlassian Community Events