Hi there,
in JIRA, we like to implement a group picker (single choice) in order to define the responsible development group for a new feature out of a small list stored in the internal user directory.
Instead of defining validators for every workflow steps (at least 2 different workflows are affected) we thought about using global Behaviours (Scriptrunner add-on). After checking the documentation, I tried this validator script for the according customfield, mapped to all projects and issue types:
import com.atlassian.jira.component.ComponentAccessor
def respDevTeamFld = getFieldByName("Responsible Development Team")
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObject(respDevTeamFld.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionsToSelect = options.findAll { it.value in ["Option 1", "Option 2", "..."] }
respDevTeamFld.setFormValue(optionsToSelect*.optionId)
Unfortunatelty, it does not work. The user picker for the customfield "Responsible Development Team" is not restricted to the defined values. The user is still able to select any group stored in the internal user directory.
Do you have any idea what is wrong?
Did you find the solution for this??
I started the approach detailed here:
Set Group Picker based on Checkboxes field in Post... (atlassian.com)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am also looking to present users with a list of 'pre-selected' groups that they can select so that the issue is assigned to that group, instead of a single agent.
Has anyone managed this yet?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear @Brüse_ Bernhard
have you been able to solve this problem and did you find a valid code snippet to enable the restriction of a group picker to specific values?
Thank you very much.
Kind regards
Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are trying to set the field value , I believe you should set the field options instead.
Please refer the below . Replace the id's with actual group id's
Let me know how it goes . Add logging it will become easier to develop the required script
FormField resDevTeam = getFieldByName("Responsible Development Team")
def ops = ["-1":"None"]
ops.put("10000","group 1")
ops.put("10001","group 2")
resDevTeam.setFieldOptions(ops)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mizan,
just tried your suggestion, but unfortunately this doesn´t work (cannot see anything being affected)!
My script:
import com.atlassian.jira.component.ComponentAccessor
FormField resDevTeam = getFieldByName("Responsible Development Team")
def ops = ["-1":"None"]
ops.put("10501","Pascal")
ops.put("11203","Keytech")
resDevTeam.setFieldOptions(ops)
Script checker tells me that class "FormField" is unable to resolve...
Any ideas how to get this up&running? Many thanks in advance,
Hans-Hermann
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe another idea/problem:
In the long run we want to select one or multi user groups based on a pre-defined list of existing user groups as we got some external partners working on our JIRA and we want to give them the possibility to browse and transition issues in certain cases.
AFAIK there is no option to show the user the entire list of possible options in a (multi) user group picker field itself (maybe the user doesn´t exactly know how the group is named), so i tried to manage this via a db driven field. Here i got the according list restricted to certain groups, but how to grant the according members of the choosen groups some permissions respectively use workflow conditions?
I could copy each time via event listener the db driven field to the user group field, but this sounds a bit creapy to me...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.