Forums

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

How to restrict Radio button from particular groups

Gsep Support February 17, 2020

Hello,

I want only specific group can use Radio button values. Is it possible through behavior plugin.

 

Thank You,

Mrityunjay Biswas

1 answer

0 votes
Leo
Community Champion
February 18, 2020

Hi @Gsep Support,

I guess it's possible, I haven't checked below code so may require minor changes

import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
String groupName = "YourGroup" //place the group here to validate
def field = getFieldByName("Field Name")

if (!groupManager.getUsersInGroup(groupName).contains(user)) {
field.setReadOnly(true) //will be visible in the form but can't edit
field.setHidden(true) //if you want to hide
}else{
field.setReadOnly(false)
field.setHidden(false)
}

 

BR,

Leo

Suggest an answer

Log in or Sign up to answer