How do I access parameters in a Jenkins pipeline script?
<p>I'm trying to use a job parameter in a pipeline script, following the <a href="https://support.cloudbees.com/hc/en-us/articles/219250317-Create-a-Parameterized-Pipeline-using-Template" rel="noreferrer">Parametrized pipeline using template documentation</a>.</p>

<p>My script:</p>

<pre><code>node { 
  // Display the parameter value of the parameter name "myparam" 
  println myparam 
  sh "echo '${myparam}'" 
}
</code></pre>

<p>but Jenkins cannot find my parameter:</p>

<pre><code>groovy.lang.MissingPropertyException: No such property: myparam for class: WorkflowScript
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:458)
    at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.getProperty(DefaultInvoker.java:33)
    at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
    at WorkflowScript.run(WorkflowScript:3)
    at ___cps.transform___(Native Method)
</code></pre>

<p>What am I missing?</p>

<p>Jenkins Version: 2.8</p>

<p>My full job xml looks like this:</p>

<pre><code>&lt;flow-definition plugin="workflow-job@2.2"&gt;
   &lt;actions /&gt;
   &lt;description /&gt;
   &lt;keepDependencies&gt;false&lt;/keepDependencies&gt;
   &lt;properties&gt;
      &lt;com.synopsys.arc.jenkinsci.plugins.jobrestrictions.jobs.JobRestrictionProperty plugin="job-restrictions@0.4" /&gt;
      &lt;hudson.model.ParametersDefinitionProperty&gt;
         &lt;parameterDefinitions&gt;
            &lt;hudson.model.StringParameterDefinition&gt;
               &lt;name&gt;myparam&lt;/name&gt;
               &lt;description&gt;bar&lt;/description&gt;
               &lt;defaultValue&gt;foo&lt;/defaultValue&gt;
            &lt;/hudson.model.StringParameterDefinition&gt;
         &lt;/parameterDefinitions&gt;
      &lt;/hudson.model.ParametersDefinitionProperty&gt;
   &lt;/properties&gt;
   &lt;definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.23"&gt;
      &lt;script&gt;node { //Dislay the parameter value of the parameter name "myparam" println myparam sh "echo '${myparam}'" }&lt;/script&gt;
      &lt;sandbox&gt;false&lt;/sandbox&gt;
   &lt;/definition&gt;
   &lt;triggers /&gt;
&lt;/flow-definition&gt;
</code></pre>