real dynamic select options

Lucas Z February 12, 2021

Hello,

I'm trying to implement the following use case in a project workflow.

As a controler I've to approve or reject a ticket in my workflow step. When approved I have to assign it to the next controler in process. the project has various project roles to distinguish approval responsibility in the whole process.

Therefore I searched for a way to dynamically pre populate the assignee user picker field on the approval transition screen. It should be limited to users that are only members of the next accountable project role. So the intential goal was to limit user selection in the assignee field.

After some investigation it appears there is no way to accomplish that. So I followed another idea. I've created a helper/transient custom field (single select) put it on the transistion screen and pre populate it with all members of the desired project role in its options. In conjuction with a scriptrunner behaviour initalizer and change script I'm able to set the now hidden assignee field on that transition screen.

So far so good, now I'm faced with the server side validation that prevent the transition due to the fact that the dynamically created options in the helper select field are unknown and invalid.

I'm slightly frustrated. :-)

I can't maintain all Users as pre defined options in the custom field configuration to filter them later as seen in many script examples. Is there a way to disable the form field validation of the custom field? Or any other ideas to implement the described use case?

Best greetings,
René

1 answer

1 accepted

0 votes
Answer accepted
Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 12, 2021

Hi @Lucas Z so you are validating your helper field? And for dynamic field, do you use this functionality?
https://scriptrunner.adaptavist.com/latest/jira/behaviours-conversions.html

Lucas Z February 14, 2021

Hi Martin,

thank you for your advice. that looks promising. i'll try the text field conversion method in the next few days and give you feedback!

Regards,

René

Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2021

ok @Lucas Z , good luck :)

Lucas Z February 18, 2021

Hi @Martin Bayer _MoroSystems_ s_r_o__ ,

the text field conversion method using FormField.convertToSingleSelect() worked. However, I did not find a way to pre-select one from the selection options supplied by the REST endpoint!

FormField.setFormValue() does not work now and I have not found any other way.

As a workaround I now use a hint in the field description. Feels incomplete but works for the user! :-)

Thanks again for your hint!
Best regards,
René

Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 18, 2021

Ok @Lucas Z happy to help. It is not easy to put default value to dynamic list because options are loaded after user starts writing...

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5.4
TAGS
AUG Leaders

Atlassian Community Events