title: Jenkins retrieve active choice parameter in groovy script
body: <p>I have one Active Choice Parameter called ENVIRONMENT.  I want to use that parameter in my next Active Choice Parameter.  How do I retrieve the previous choice?</p>
  
  <p>Here is my code.  I cannot figure out how to retrieve the ENVIRONMENT variable from the previous parameter and assign it to my env variable in my new groovy script for my second variable.</p>
  
  <pre><code>import groovy.sql.Sql
  
  String env = $ENVIRONMENT
  
  def output = []
  def db = [url:'jdbc:oracle:thin:@database_host:1521:SID', user:'username', password:'password', driver:'oracle.jdbc.OracleDriver']
  def sql = Sql.newInstance(db.url, db.user, db.password, db.driver)
  String sqlString = ("select distinct logical_host from SERVER_NAME_VW where app='ME' and env = ${env} order by 1")
  
  sql.eachRow(sqlString){ row -&gt;  
      output.push(row[0])
  }
  
  return output
  </code></pre>