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")
Community moderators have prevented the ability to post new answers.
Hi,
you can try if
def securityField = getFieldByName("level")
works.
Regards,
Michael Danielsson
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.