Jenkins Plugin:Extended Choice Parameter from JSON file Extended Choice Parameter plugin query: How to load params dynamically from a JSON file for jenkins build job. Here is my jenkins script to add normal parameters and Extended Choice parameters as well.

p

roperties([
        [$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '500']],
        parameters([extendedChoice( 
        defaultValue: 'One,Two,Three,Four', 
        description: '', 
        multiSelectDelimiter: ',', 
        name: 'SAMPLE_EXTENDED_CHOICE', 
        quoteValue: false, 
        saveJSONParameterToFile: false, 
        type: 'PT_CHECKBOX', 
        value:'One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten', 
        visibleItemCount: 10)
        ])
])


This is working. But I want to be able to load parameters from a JSON file (using Extended Choice Parameter plugin). How can I modify the above script to accomplish that? PS: Here is the reference for Extended Parameter plugin. https://plugins.jenkins.io/extended-choice-parameter/
EDIT: Updating my answer to include steps on using the Declarative Directive Generator.

You can experiment with the different available configuration options, and sometimes gets hints as to what certain settings provide. For this specific case:


Navigate to &lt;$JENKINS_URL&gt;/directive-generator/
Select parameters: Parameters from the Sample Directive drop-down.
Click the Add button and select extendedChoice: Extended Choice Parameter
Select JSON Parameter Type and then experiment with the available options.
When finished, click Generate Declarative Directive to generate the code block to paste into your pipeline.




You can add the javascriptFile parameter and change the type to PT_JSON.

Using your example:

properties([
    [$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '500']],
    parameters([extendedChoice( 
    defaultValue: 'One,Two,Three,Four', 
    description: '', 
    javascriptFile: '/path/to/file.json',
    multiSelectDelimiter: ',', 
    name: 'SAMPLE_EXTENDED_CHOICE', 
    quoteValue: false, 
    saveJSONParameterToFile: false, 
    type: 'PT_JSON', 
    value:'One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten', 
    visibleItemCount: 10)