The Extended Choice Parameter plugin is great and I use it in jobs configured via the UI https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin
How
Works for me :
I needed to retrieve all the versions number of artifacts from a Nexus Repo:
properties ([
parameters([
choice(choices: ['PROD', 'DEV', 'QA'], description: '', name: 'ParamEnv' ),
string(name: 'ParamVersion', defaultValue: '', description: 'Version to deploy'),
extendedChoice(
name: 'someName',
description: '',
visibleItemCount: 50,
multiSelectDelimiter: ',',
type: 'PT_SINGLE_SELECT',
groovyScript: '''
import groovy.json.JsonSlurper
List nexusPkgV = new ArrayList()
def pkgObject = ["curl", "https://xxxx:xxxx@xxxxxxxxxx"].execute().text
def jsonSlurper = new JsonSlurper()
def artifactsJsonObject = jsonSlurper.parseText(pkgObject)
def dataA = artifactsJsonObject.items
for (i in dataA) {
nexusPkgV.add(i.version)
}
return nexusPkgV
'''
)
])
])