I have a DynamicReferenceParameter with choiceType:'ET_FORMATTED_HTML'. I can see it changes it's "display value" according to the script code. However when I try to read it's "value" from the Jenkinsfile, I only see empty string. Is there a way to get the same html value there?
The other parameters I can see with: "$params.FOO", but not for this DynamicReferenceParameter
For me i have to set the html input value field to
value
And set omitValueField: true,
as below
[$class: 'DynamicReferenceParameter',
name: 'DEPLOY_VERSION',
description: 'Version for deployment',
choiceType: 'ET_FORMATTED_HTML',
omitValueField: true,
referencedParameters: 'ENV,BUILD_VERSION',
script: [
$class: 'GroovyScript',
fallbackScript: [
classpath: [],
sandbox: true,
script: "return ['Could not determine version']"
],
script: [
classpath: [],
sandbox: true,
script: """
if (ENV == 'prod') {
return '<input name="value" value="" placeholder="Enter deployment version" style="width:300px; height:30px; font-size:14px;" />'
} else {
return '<input name="value" value="' + BUILD_VERSION + '" readonly style="width:300px; height:30px; font-size:14px; background-color:#d3d3d3;" />'
}
"""
]
]
]
Then get the value like this
echo "deploy version : ${params.DEPLOY_VERSION}"