title: How to send referencedParameters value in Jenkins pipeline for CascadeChoiceParameter to ScriptlerScript
body: <p>I'm declaring 2 parameters in <strong>properties</strong> section of a Jenkins pipeline:<br/></p>
  
  <ul>
  <li>a data center (can have multiple environment types)<br/></li>
  <li>an environment type<br/></li>
  </ul>
  
  <p>The data center is of type <strong>ChoiceParameter</strong>; the list is retrieved from a database; when the data center changes in the drop-down list, the environment types should populate accordingly, also from the database, through a <strong>ScriptlerScript</strong>.<br/>
  The problem is that when changing selection on data center, nothing happens for environment types list, which is a <strong>CascadeChoiceParameter</strong> with <strong>referencedParameters: 'DataCenter'</strong>.<br/><br/>
  How should I link the referenced parameter to the scriptlet script I'm using - what do I have to send ?</p>
  
  <p>The issue is with <strong>[name:'DataCenter', value: '$DataCenter']</strong> for second parameter - the value is not sent to the ScriptletScript when first drop-down value changes.<br/><br/>
  If I define the 2 parameters from the Jenkins interface - so not through the DSL pipeline - under <strong>Configure</strong> section, everything works as expected.<br/><br/>
  It's not working for me to use something other than <strong>properties</strong> section - I've tried using <strong>activeChoiceParameter</strong> inside <strong>pipeline</strong> section, but I get an error '<em>Build parameters definitions cannot have blocks @ line (...)</em>', which is a known issue (see first example link below).<br/><br/>
  Examples I've used: <br/>
  <a href="https://stackoverflow.com/questions/53852261/jenkinsfile-active-choice-parameter">Jenkinsfile Active Choice Parameter</a> <br/>
  <a href="https://stackoverflow.com/questions/43410204/active-choices-reactive-reference-parameter-in-jenkins-pipeline">Active Choices Reactive Reference Parameter in jenkins pipeline</a></p>
  
  <pre class="lang-java prettyprint-override"><code>properties([
    parameters([
      [
        $class: 'ChoiceParameter', 
        choiceType: 'PT_SINGLE_SELECT', 
        name: 'DataCenter', 
        script: [
          $class: 'ScriptlerScript', 
          scriptlerScriptId:'getdatacenters.groovy',
          parameters: [
            [name:'StatusId', value:'']
          ]
        ]
      ],
      [
        $class: 'CascadeChoiceParameter',
        choiceType: 'PT_SINGLE_SELECT',
        name: 'EnvironmentType', 
        script: [
          $class: 'ScriptlerScript',
          scriptlerScriptId:'getenvtypesbydatacenter.groovy',
          referencedParameters: 'DataCenter',
          parameters: [
            [name:'DataCenter', value: '$DataCenter']
          ]
        ]
      ]
    ])
  ])
  
  pipeline {
  ...
  </code></pre>
  
  <p><strong>Expected result:</strong> Second drop-down list populates when data center changes<br/>
  <strong>Actual result:</strong> Nothing happens when data center changes<br/></p>
  
  <p>Pipeline with params configured in UI - behaves ok (environment types loading on data center change):</p>
  
  <p><img src="https://i.stack.imgur.com/bfV6N.png" alt="screenshot"></p>