title: Jenkins - How to get properties/fields of choice param defined in shared lib
body: <p>We have defined set of choice parameters in our shared Jenkins library, and I have a job in which I want to be able to create a set of permutations of some of them. e.g.:
  in shared <code>dynamic_params.groovy</code>:</p>
  <pre><code>def dev_team() {
      def teams = ['backend', 'frontend']
      return choice(name: 'team', description: 'Choose the name of the team', choices: teams)
  }
  
  def environment() {
      def environments = ['prod', 'qa', 'staging']
      return choice(name: 'environment', description: 'Choose an environment', choices: environments)
  }
  </code></pre>
  <p>Then, all I wanna do is, in a job, something like:</p>
  <pre><code>def envTeams = [:]
  
  for (env in dynamic_params.environment().choices) {
      for (team in dynamic_params.dev_team().choices) {
          envTeams[env] = team
      }
  }
  ......
  </code></pre>
  <p>(examples are mocked)</p>
  <p>But I get <code>org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: No such field found: field </code></p>
  <p>I'm not even yet sure what do I get when I do <code>dynamic_params.environment()</code> because Jenkins prints
  <code>@choice(name=environment,description=Choose an environment,choices=[prod, qa, staging])</code>
  (Does that mean I have a class?)</p>
  <p>Thanks</p>