Child pages
  • Extensible Choice Parameter plugin

Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

Plugin Information

View Extensible Choice Parameter on the plugin site for more information.

Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:

This plugin adds "Extensible Choice" as a build parameter.You can select how to retrieve choices, including the way to share choices among all jobs.

What's this?

This plugin provides a Extensible Choice parameter:

  • When building, the value can be selected with a dropdown like a built-in Choice parameter.
  • The choices can be provided in several ways:
    • Global Choice Parameter: defines choices in the Configure System page.
      • Choices can be shared by multiple jobs.
      • Updating the choices in the Configure System, every job can immediately refer the updated choices.
    • Textarea Choice Parameter: writes choices in a textarea, just like a built-in Choice parameter.
    • System Groovy Script Choice Parameter: runs a System Groovy script to determine the list of choices
    • File Choice Parameter: lists files in a directory.
  • Checking Editable checkbox allows you to specify any value, even one not in the choices.
    • Edited values can be added to the choice used next time automatically by checking "Add Edited Value".
  • You can add a new way to provide choices with Extension Points.

Disabling providers

Some choice providers may cause security issues in your system:

Choice Provider

Security Issue


File Choice Parameter

Any users with project configuration privilege can list files in the OS with the privilege of the OS user Jenkins run with.

Users can do that also with "Execute shell" or "Execute Windows Batch" build step.

You can disable specific providers in system configuration page:

In the above screen, System Groovy Script Choice Parameter (unchecked one) is disabled.


  • "Extensible Choice" is added as a type of build parameters.
  • You can select the way to define choices of the parameter.
    ** A new way to provide choices can be added with Extension Points.
  • Selecting "Textarea Choice Parameter", you can define choices like the built-in Choice parameter.
  • "Global Choice Parameter" enables you to select a set of choices from the ones defined in System Configuration page.
    • Defining in System Configuration page:
    • Select which set of choices to use:
  • "System Groovy Choice Parameter" generate choices with a Groovy script:
  • "File Choice Parameter" enables select a file in a specified directory:
  • You can specify its default value. This is useful with Global Choice Parameter to specify different default values in jobs:
  • Checking "Editable" enables you to input a value not in choices at build time:
    ** Textarea Choice Parameter and Global Choice Parameter provides "Add Edited Value", which automatically adds a value not in the choice list:

Extension point

A new way to provide choices can be added with extending ChoiceListProvider, overriding the following method:

abstract public List<String> getChoiceList()


Open Issues

To report a bug or request an enhancement to this plugin please create a ticket in JIRA (you need to login or to sign up for an account). Also have a look on How to report an issue


Change Log

Version 1.6.0 (May 20, 2018)

  • Add an option to switch the behavior of input value when the input is editable (JENKINS-22316, JENKINS-50315)
    • You can select "Display all choices" (the behavior same to Extensible Choice Paramter <= 1.4.2) or "Display only matching choices" (the behavior same to Extensible Choice Paramter 1.5.0).
    • "Display all choices" is the default behavior.

Version 1.5.0 (Mar 17, 2018)

Version 1.4.2 (Jan 27, 2018)

Version 1.4.1 (Aug 27, 2017)

Version 1.4.0 (Apr 10, 2017)

  • SECURITY FIX: Jenkins Security Advisory 2017-04-10#Extensible Choice Parameter Plugin
    • Groovy scripts run with Script Security Plugin
    • Existing scripts are configured to run in the script sandbox.
    • You might require approve some methods for the sandbox, or configure scripts run without the sandbox and approve scripts.
  • Targets Jenkins >= 1.580.1.
  • The pre-defined variable 'jenkins' is no longer provided.
    • You can get Jenkins instance with jenkins.model.Jenkins.instance instead. Require appropriate approving.

Version 1.3.4 (Jan 28, 2017)

  • Use the top most value if the specified default parameter isn't contained in the choice list.
    • Note: Builds fail if you passed a value not contained in the choice list explicitly (e.g. via Parameterized trigger plugin).

Version 1.3.3 (Oct 22, 2016)

  • FIXED: "Top Most Value" is replaced with an empty value when saved before the job configuration page is completed to be load (JENKINS-37147)

Version 1.3.2 (Aug 23, 2015)

  • Fixed UnsupportedOperationException when Empty Choice is configured for File Choice Parameter (JENKINS-29934)
  • Improved the help of Exclude Pattern of File Choice Parameter.

Version 1.3.1 (Jun 20, 2015)

  • Fixed NPE with "List Files Now" in configuration pages (JENKINS-28841, regression in 1.3.0)

Version 1.3.0 (May 05, 2015)

  • Now you can disable specific providers in system configuration page (JENKINS-27375).
  • Validates parameter names by checking they can be handled by Jenkins core (JENKINS-22222).
  • Fixed "Error: No stapler-class is specified" when saving project configuation with Jenkins 1.610(JENKINS-28046).
    • Dot letters are allowed for variable names with Jenkins > 1.526.
  • Added an empty choice option to FilenameChoiceListProvider (JENKINS-22318).
  • Also accepts $class introduced in Jenkins 1.588 (JENKINS-25403).

Version 1.2.2 (Dec 08, 2013)

  • Added feature to use project in System Groovy Script. JENKINS-17875
  • Added feature to reverse file lists.

Version 1.2.1 (Jun 22, 2013)

  • Added documents for System Groovy Script Choice Parameter.
  • Added "Run the Script Now" Button for System Groovy Script Choice Parameter.

Version 1.2.0 (May 03, 2013)

  • Added new providers
    • System Groovy Script Choice Parameter: runs a System Groovy script to determine the list of choices
    • File Choice Parameter: lists files in a directory.
  • Added checkbox "Add Edited Value" to Textarea Choice Parameter and Global Choice Parameter. By checking this, edited values used in builds are automatically added to choices.

Version 1.1.0 (Feb 06, 2013)

  • Now you can select the default choice in each job.
  • Fixed the misspell.

Version 1.0.0 (Jan 07, 2013)

  • Initial release.


  1. Unknown User (savithari)


    This plugin is real nice.  I need a bit of clarification.  I am using the System Groovy Choice Parameter option.  I wrote a small fragment of groovy script to populate a list of parameter choices.

    It works fine, no problem.

    However if I want to read a first parameter and based on that I want the groovy script to build a diff list each time for the second parameter.  Is this eve possible and if so how do we do that ?

    Thank You for your time and attention.


    1. Unknown User (ikedam)

      Unfortunately, this plugin does not support that feature.
      This plugin generates choices only once when displaying the building page.

  2. Unknown User (jl.pinardon)


    Interesting plugin, but I think it lacks a very simple feature : get the choices from a file.
    Simply configure a file path and the plugin gets each line as a choice item.

    I guess it can be easily scripted using a groovy script, but not all build managers are groovy skilled.

    Best Regards and thanks for your help and attention.

  3. Unknown User (deeno)

    The file choice option is great, thanks!  As a suggestion, it would be nice if the default can be set to a blank or something similar.  The way it is now, it's too easy for a user to select the default (first file) inadvertently

  4. Unknown User (ioannis)

    Great plugin but is there an option for multi-select? With so many ways of generating the selectable options, I think that this plugin would be the best in supporting this need. Thank you! 

  5. Unknown User (zioschild)

    After the parameterized trigger plugin is doing a type-check we have to use this plugin too. Nice :-) But the switch of type is not as easy as i thougt.

    Please can you have a look at issue 22222? The is no default-assignee so i also write it here in the commons.

    Thank you.

  6. Unknown User (prithvi_singh)

    Hi ikedam,

                        thanks a lot for build really nice plugin,just to check are you thinking of enhancing this plugin to support populating the list based on selection of other list.



    1. Unknown User (ikedam)

      I don't plan that extension.
      Extensible choice parameter generates choices when displaying a build parameter page, and cannot update choices after displaying the page.

  7. Unknown User (juanitogan)

    Thanks for this great plugin.  As an example of how to use it with a Groovy script -- and how to use it to replace the odd Git Parameter Plugin -- I posted this to my blog:

    Jenkins and Git at Plaid Speed

  8. Unknown User (savithari)

    Question about the plugin.  Is there a way to know what the WORKSPACE folder is, inside of the plugin groovy script.

    I want to be able to do 

    def x=$WORKSPACE

    But is $WORKSPACE going to get resolved at plugin time or build time ?

  9. Unknown User (ikedam)

    No, you can never get WORKSPACE in your script as Jenkins doesn't decide where to run the build yet.

  10. Unknown User (tartarus)

    Hi, was testing this plugin in the lates jenkins release and got the "no stapler-class is specified" error. I tried to fix this by changing "> 

    to use class instead of stapler-class. This did not work, do I have to make additional changes to the jelly files as well?">to use class instead of stapler-class. This did not work, do I have to make additional changes to the jelly files as well?

    my change:


          String staplerClazzName = formData.optString("$class", null);
                if (staplerClazzName == null) {
                    staplerClazzName = formData.optString("stapler-class", null);
                if (staplerClazzName == null) {
                    throw new FormException("No $class or stapler-class is specified", fieldName);

                String staplerClazzName = formData.optString("$class", null);
                if (staplerClazzName == null)

    Unknown macro: {                staplerClazzName = formData.optString("stapler-class", null);            }

                if (staplerClazzName == null)

    Unknown macro: {                throw new FormException("No $class or stapler-class is specified", fieldName);            }
    1. Unknown User (ikedam)

      Thanks for the report.
      That looks related to JENKINS-25403.
      I think your change works well.

      I'm planning to make a new release in a month and will fix it in that release.

      You might consider to use the LTS Jenkins release instead of the latest one if you don't want to use the modified extensible-choice-parameter and you don't need new features in the latest Jenkins.

  11. Unknown User (jimi_svensktnaringsliv)

    We currently have several projects that use the same exact "Groovy System Script", that we have to copy-paste into each project. Is it possible to define a global script somehow, and reference it in each project?

  12. Unknown User (jimi_svensktnaringsliv)

    One more question: Is it possible to define a default file for the File Choice Parameter? Currently it selects the first one in the list, and it seems to be sorted alphabetically.

    Great plugin by the way :)

  13. Unknown User (ivan_zolotuhin)

    Example to generates password. (Dynamic Parameter -> Default Value Script)

    import org.apache.commons.lang.RandomStringUtils
    String charset = (('a'..'z') + ('0'..'9')).join()
    Integer length = 10
    String randomString = RandomStringUtils.random(length, charset.toCharArray())
    return randomString
    return randomString
  14. Unknown User (vincentjorgensen)

    Will execute work? e.g.

    ("git tag".execute()).text.split('\n').collect{it as String}
  15. Unknown User (cedriclevasseur)

    If you want to access to ParametersName of the build :

    (don't forget the import)

    import hudson.model.*
    def toReturn=[]
       toReturn.add( );

    import hudson.model.*
    def toReturn=[]
       toReturn.add( );
    1. Unknown User (cedriclevasseur)

      sorry for double code snippet, just use the second one

  16. Unknown User (jthornsen)

    What is the difference between this plugin and Extended Choice Parameter plugin ?

  17. Unknown User (joerhce)

    I am using Extensible Choice Parameter for my build. And my requirement is to trigger which is inside A/B/C/ Now i want to select through my input. So i added three File Choice Parameter and i am facing issue of passing the value of first parameter to the input of second parameter

    Variable-1 : AAA and its Base directory is /tmp/A

    Variable-2 : BBB and its Base Directory is /tmp/$

    Unknown macro: {AAA}

     --- Not Working as it couldnt understand $

     whereas if i hardcode with actual value (/tmp/A) then it is working absolutely fine.

    Variable-3 : CCC and its Base Directory is /tmp/$

    Unknown macro: {AAA}


    Unknown macro: {BBB}

     --- Not Working as it couldnt understand $

    & $

    Unknown macro: {BBB}

    whereas if i hardcode with actual value (/tmp/A/B/C) then it is working absolutely fine.

    I am struck on this. please help with your inputs.

    1. Unknown User (navin31091)

      Hi Joel,

      Did you get the soultion to this? I too am facing exactly similar issue.

  18. Unknown User (dgtlrift)

    I'm trying to use the Groovy Choice parameter to parse choices stored in the target repository of the project.  It's an XML file, and parsing the parameters is not an issue, but how would I use either hudson.scm.SCM or hudson.plugins.tfs to access the individual filestream?

  19. Unknown User (simona01pop)


    Is there a limit to the number of properties of a certain type a JSON object can have for this Plugin?

    I have defined 20 or so properties like this:

    "port1": {
    "title": "Port1",
    "type": "array",
    "format": "table",
    "uniqueItems": true,
    "propertyOrder": 1,
    "options": {
    "grid_columns": 3
    "items": {
    "type": "string",
    "title": "vlan",
    "propertyOrder": 1,
    "enum": [
    "default": [

    The groovy script gets rendered just fine when I build the Job.

    Once I add one more property, exactly the same as before, it doesn't. If I try adding a string property instead that works just fine.

    I also have tested my schema using and there it works without any issues.

    Can you think of anything that might cause this behaviour in Jenkins?


  20. Unknown User (afrancoc2000)

    Can I use this inside a jenkinsfile?

    1. Unknown User (dvdgsng)

      Yes you can, but as usual, Jenkins plugin documentation is a PITA to figure out how to actually do it.

      So, here's an advanced example on how to use this with a scripted pipeline, where the entries are generated by a Groovy script that returns a list of strings.

      ExtensibleChoiceParameterDefinition Example
      		[ name: 'myFooProperty',
      			description: 'Auto-generated list of Foo',
      			$class: 'ExtensibleChoiceParameterDefinition',
      			editable: true,
      			choiceListProvider: [
      				$class: 'SystemGroovyChoiceListProvider',
      				usePredefinedVariables: true,
      				groovyScript: [
      					classpath: [],
      					sandbox: true,
      					script: readFile('path-to-my-script-on-disk-to-generate-the-list-values.groovy')
  21. Unknown User (finnyraj)

    Does this plugin support listing a directory from another server where jenkins is not running ?

    I see the location specified in 'Base Directory', is being looked for on the jenkins server itself. Is it possible to define a different server added as a slave node or through ssh ?



  22. Unknown User (sbonami)

    Hi, is there a way to run a Groovy script (.groovy file on disk) instead of putting the code in the "Groovy Script" box?

  23. Unknown User (timk)

    I have two parameters in a project - a string parameter and extensible choice parameter. I would like to update values in the choice parameter when a value is entered/updated in the string parameter. Any idea how to do this?


  24. Unknown User (zentavr)

    I did a build of this plugin which allows extendedChoice() to be used in the parameters block of a declarative pipeline.

    The work was done by Craig Rodrigues and original pull request is here. You can download the build from our github repo.