I have the following declarative pipeline. It defines checkbox multi-choice parameter:

pipeline {
    agent any 
    options {
    parameters { 
        extendedChoice description: '', multiSelectDelimiter: ',', name: 'NAMES', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_CHECKBOX', value:'a,b,c', visibleItemCount: 3
    stages {
      stage('Run on all') {

        steps { 
            script {
                  println params.NAMES 


My goal is to call the pipeline via Jenkins CLI where passed values to NAMES parameter signifies selected checkboxes.

Running java -jar jenkins-cli.jar -s http://localhost:8080 -auth u:p -p NAMES='a' causes empty string to be printed by println params.NAMES

Expected a to be printed after calling the pipeline via Jenkins cli client.

The only way that worked is adding commas after a: java -jar jenkins-cli.jar -s http://localhost:8080 -auth u:p -p NAMES='a,,'

Is it the correct syntax to pass checkbox selections of extendedChoice type parameter?

1 Answer 1


Try with tokenize (,) since the options were saved like a string. Save 'NAMES' into a new variable, then tokenize with a comma "," since it was configured the parameters with multiSelectDelimiter: ',' Finally, you can iterate the array with a for-loop and use the elements as desire.

  def arr = userInput['NAMES'].tokenize(',')

  arr.each { t ->
    // t is the parameter option
    sh("echo ${t}")
  • This might work and thank you for contributing, but a very good answer would say why and explain the code a bit
    – Peter Turner
    Jun 21, 2021 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.