Hello,
I'm currently creating a prototype to evaluate JIRA and ScriptRunner, and have some issues I need to learn about.
1- How do I set a "User Picker" field to display values based on another field's value on the same screen when creating an issue.
i.e: I have multiple Centers in my organization. If user picks Center = HQ, I need the "Manager" field to display only HQ Managers.
2- Also , what is the best way to set a series of users in the background based on that same choice. The issues will get assigned to those users as the flow moves forward. Currently I set a post function with the attached script. I then copy those values into "User" fields during transitions.
Thank you,
André
Hi,
Are there any updates availables about this please ?
I am interested in this feature in Scriptrunner.
Thanks
Camille
We have been investigating this since you posted this question. The short answer is its just about possible with Behaviours but we don't really provide an easy way of doing this sort of thing unless you write your own REST endpoint.
I have raised a feature request and we will add this feature in a future sprint. You can track the progress of it here: https://productsupport.adaptavist.com/browse/SRJIRA-1900
If your going to roll your own thing then I suggest you read up on the documentation I have linked you to here.
We do a similar thing for picking issues, you can see the examples here: https://scriptrunner.adaptavist.com/latest/jira/behaviours-conversions.html
If your comfortable with the examples provided above then you could write your own.
Using behaviours and setting the following script on the field where the user selects "managers" would work if you have defined those endpoints yourself like in the examples:
if (getActionName() == "Create") { def selectListField = getFieldById(fieldChanged) def multiUserPicker = getFieldByName("TextFieldForUsers") if (selectListField.value == "Managers") { // set manager users here using multiUserPicker multiUserPicker.convertToMultiSelect([ ajaxOptions: [ url : getBaseUrl() + "/rest/scriptrunner/latest/custom/myissuepicker/managers", query: true, formatResponse: "general" ] ]) } else if (selectListField.value == "Other") { // set other users multiUserPicker.convertToMultiSelect([ ajaxOptions: [ url : getBaseUrl() + "/rest/scriptrunner/latest/custom/myissuepicker/otherusers", query: true, formatResponse: "general" ] ]) } }
For the second question, it sounds like if you want to select a series of users based on a transition change then post-function are the best way.
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was planning on using it for single user picker, but would be helpful to know if it were also feasible for multi user picker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For 1) is it a single user picker or a multi one you are using?
Also would you be able to add the following tag to your answer so other people can find it when they search: groovy-script-runner
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Today only! Share what you’re the most excited about for Team ‘25 or just dance out the beginning of a new quarter with us.
Comment the postOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.