title: Active choice parameter with declarative Jenkins pipeline
body: <p><br />
  I'm trying to use active choice parameter with declarative Jenkins Pipeline script.</p>
  <p>This is my simple script:</p>
  <pre><code>
  environments = 'lab\nstage\npro'
  
  properties([
      parameters([
          [$class: 'ChoiceParameter',
              choiceType: 'PT_SINGLE_SELECT',
              description: 'Select a choice',
              filterLength: 1,
              filterable: true,
              name: 'choice1',
              randomName: 'choice-parameter-7601235200970',
              script: [$class: 'GroovyScript',
                  fallbackScript: [classpath: [], sandbox: false, script: 'return [&quot;ERROR&quot;]'],
                  script: [classpath: [], sandbox: false, 
                      script: &quot;&quot;&quot;
                          if params.ENVIRONMENT == 'lab'
                              return['aaa','bbb']
                          else
                              return ['ccc', 'ddd']
                      &quot;&quot;&quot;
                  ]]]
      ])
  ])
  
  pipeline {
      agent any
      tools {
          maven 'Maven 3.6'
      }
      options {
          disableConcurrentBuilds()
          timestamps()
          timeout(time: 30, unit: 'MINUTES')
          ansiColor('xterm')
      }
      parameters {
          choice(name: 'ENVIRONMENT', choices: &quot;${environments}&quot;)
      }
      stages {
          stage(&quot;Run Tests&quot;) {
              steps {
                  sh &quot;echo SUCCESS on ${params.ENVIRONMENT}&quot;
              }
          }
      }
  }
  
  </code></pre>
  <p>But actually the second parameter is empty</p>
  <p><a href="https://i.stack.imgur.com/fHm3S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fHm3S.png" alt="enter image description here" /></a></p>
  <p>Is it possible to use together scripted active choice parameter and declarative parameter?</p>
  <p><strong>UPD</strong>
  Is there any way to pass list variable into script? For example</p>
  <pre><code>List&lt;String&gt; someList = ['ttt', 'yyyy']
  ...
  script: [
      classpath: [], 
      sandbox: true, 
      script: &quot;&quot;&quot;
          if (ENVIRONMENT == 'lab') { 
              return someList
          }
          else {
              return['ccc', 'ddd']
          }
      &quot;&quot;&quot;.stripIndent()
  ]
  </code></pre>