# Dynamic Parameter Creation in Jenkins - Issues: groovy.lang.MissingPropertyException

**URL:** <https://community.jenkins.io/t/dynamic-parameter-creation-in-jenkins-issues-groovy-lang-missingpropertyexception/11708>\
**Category:** Using Jenkins\
**Tags:** question, pipeline\
**Created:** [January 10, 2024, 2:07pm UTC](https://community.jenkins.io/t/dynamic-parameter-creation-in-jenkins-issues-groovy-lang-missingpropertyexception/11708 "2024-01-10T14:07:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepak](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@Deepak](https://community.jenkins.io/u/Deepak)\
**Post date:** [January 10, 2024, 2:07pm UTC](https://community.jenkins.io/t/dynamic-parameter-creation-in-jenkins-issues-groovy-lang-missingpropertyexception/11708/1 "2024-01-10T14:07:12Z")

</div>

Jenkins Version: 2.414.3

```auto
def jobProperties() {
    params = jobParams()

    properties([
        parameters(
            params
        )
    ])
}

def jobParams() {
    def allChoices = []

    // Get Subprojects list from parameter Store
    def paramChoices = sh(script:'echo $(aws ssm get-parameter --name "PATH" --query Parameter.Value --region $(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region) --with-decryption | xargs)',returnStdout: true).trim()
    // def paramChoices = "proj1,proj2,proj3,proj4"
    def commonChoices = paramChoices.split(",") as List

    // Generate choices dynamically
    for (int i = 1; i < commonChoices.size(); i++) {
        // def name1 = (char)('A' + i)
        def name = "STEP_${i}"
        // def name = "SEQUENCE_${(char)(65+i)}"
        // def individualChoices = commonChoices
        allChoices += choice(name: name, choices: commonChoices)
    }

    return allChoices
}

pipeline {
    agent any
    stages {
        stage('Prepare') {
            steps {
                script {
                    jobProperties()
                    echo $(params.STEP_1)
                }
            }
        }
    }
}

```

In the above code, I’m trying to dynamically create Choice parameters based on the number of  
subprojects from AWS Parameter store. The parameters are getting created but when I try to access these parameters i.e. when I try to use params.STEP\_1, jenkins is throwing below error. Please suggest/help on this.

````auto
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 1c76a536-17b4-4ba2-bf64-9ae0224b51f7
groovy.lang.MissingPropertyException: No such field found: field org.jenkinsci.plugins.workflow.cps.UninstantiatedDescribableWithInterpolation STEP_1
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:402)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:386)
	at org.kohsuke.groovy.sandbox.impl.Checker$7.call(Checker.java:375)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:379)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:342)
	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29)
	at org.jenkinsci.plugins.workflow.cps.LoggingInvoker.getProperty(LoggingInvoker.java:121)
	at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
	at WorkflowScript.run(WorkflowScript:40)
	at ___cps.transform___ (Native Method)
	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:73)
	at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
	at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:65)
	at jdk.internal.reflect.GeneratedMethodAccessor263.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:152)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:146)
	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:136)
	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:275)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:146)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:187)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:423)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:331)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:295)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:97)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
	at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
    ```
````

---

<div class="post-metadata">

**Author:** ![poddingue](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/poddingue/32/985_2.png) [@poddingue](https://community.jenkins.io/u/poddingue)\
**Post date:** [January 11, 2024, 9:41am UTC](https://community.jenkins.io/t/dynamic-parameter-creation-in-jenkins-issues-groovy-lang-missingpropertyexception/11708/2 "2024-01-11T09:41:29Z")

</div>

Welcome back @Deepak 👋

Are you sure the parameters you’re trying to access (`params.STEP_1`) are available when you execute your pipeline?
