How to get value from input in DynamicReferenceParameter

Hi, @marecki !

From my experience, parameters are designed to return just strings as values, not a Java constructions (like Maps, Lists, etc).
There is two ways how to solve your case: Hack and Jenkins way.
Jenkins way is to split all your inputs to separate parameters. Also, please note - if you use custom inputs in choice type ET_FORMATTED_HTML, you should set omitValueField: true.

Hack is that you still can use one ET_FORMATTED_HTML parameter for all your inputs. And combine all this inputs using Javascript to one string, splitted by ,. In this case you can use your parameters in pipeline like this:

List strategyParams = params.strategyParams.tokenize(',')
sh ".... -P testDelay=${strategyParams[0]} -P randomFactor=${strategyParams[1]} -P limitType=${strategyParams[2]} -P testLimit=${strategyParams[3]} ...."

Really bad way because you would need to maintain Javascript, parameter html and pipeline code to make sure the order is correct.

1 Like