Answers: <p><a href="https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin" rel="nofollow noreferrer">Extended Choice Parameter plugin</a> is the way to go for such requirement. You need to select Extended Choice Parameter from the drop-down list as shown below:</p>
  
  <p>enter image description here</p>
  
  <p><a href="https://i.sstatic.net/phuGh.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/phuGh.png" alt="enter image description here"></a></p>
  
  <p>In Name text-box, assign a name. For example, Environment. This is the name with which you will be accessing all the values (dev1,dev2,...) that you will select while triggering the build. Now, in Simple Parameter Types section, you will see another drop-down with the name Parameter Type. Select Multi Select from that drop-down. Now, in Choose Source for Value section, enter the values (dev1,dev2,qa1,qa2,...) in Value box. Comma (,) is the default delimiter. Refer screenshot below:</p>
  
  <p>enter image description here</p>
  
  <p><a href="https://i.sstatic.net/Nwvr5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Nwvr5.png" alt="enter image description here"></a></p>
  
  <p>Once you are done with the above settings, you will then have to access the selected option in your script (using variable assigned to Name as described above) and decide the course of action.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-02-07T06:58:32.913Z
Answers: Harsh Manvar, thanks. Cant we restrict the parameters as a first step and throw an exception? My interest is in string parameter input and not choice parameters. Only one parameter (servername) is input for a build to execute, no comma separated inputs like (servername1,servername2) must be provided.
Answers: Narasimha
Answers: CC BY-SA 4.0
Answers: 2019-02-07T07:00:44.350Z
Answers: maybe possible it is have to check or implement or try ...i have not tried it
Answers: Harsh Manvar
Answers: CC BY-SA 4.0
Answers: 2019-02-06T05:58:06.667Z
Answers: 2019-02-06T05:58:06.667Z
Answers: Harsh Manvar
Body: <p>I have the below pipeline script with string parameters. The Target parameter will fail if multiple comma separated inputs are provided in Jenkins. How can I restrict the Jenkins pipeline to accept just one value as parameter and not multiple comma separated values.</p>
  
  <pre><code>properties([
  parameters([
      string(defaultValue: '', description: '', name: 'ID'),
      string(defaultValue: '', description: '', name: 'Target')
      ])
  ])
  </code></pre>
  
Tags: <jenkins-pipeline>
Title: How to restrict only one parameter in jenkins pipeline
UserDisplayName: Narasimha
ThreadText: # How to restrict only one parameter in jenkins pipeline
  
  (Asked by: username_0 on 2019-02-01)
  
  I have the below pipeline script with string parameters. The Target parameter will fail if multiple comma separated inputs are provided in Jenkins. How can I restrict the Jenkins pipeline to accept just one value as parameter and not multiple comma separated values.
  
  ```
  properties([
  parameters([
      string(defaultValue: '', description: '', name: 'ID'),
      string(defaultValue: '', description: '', name: 'Target')
      ])
  ])
  
  ```
  
  **Tags:** jenkins-pipeline
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-06. Score: 1
  
  [Extended Choice Parameter plugin](https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin) is the way to go for such requirement. You need to select Extended Choice Parameter from the drop-down list as shown below:
  
  enter image description here
  
  [![enter image description here](https://i.sstatic.net/phuGh.png)](https://i.sstatic.net/phuGh.png)
  
  In Name text-box, assign a name. For example, Environment. This is the name with which you will be accessing all the values (dev1,dev2,...) that you will select while triggering the build. Now, in Simple Parameter Types section, you will see another drop-down with the name Parameter Type. Select Multi Select from that drop-down. Now, in Choose Source for Value section, enter the values (dev1,dev2,qa1,qa2,...) in Value box. Comma (,) is the default delimiter. Refer screenshot below:
  
  enter image description here
  
  [![enter image description here](https://i.sstatic.net/Nwvr5.png)](https://i.sstatic.net/Nwvr5.png)
  
  Once you are done with the above settings, you will then have to access the selected option in your script (using variable assigned to Name as described above) and decide the course of action.
  
  > **Comments:**
  > **username_0**: username_1, thanks. Cant we restrict the parameters as a first step and throw an exception? My interest is in string parameter input and not choice parameters. Only one parameter (servername) is input for a build to execute, no comma separated inputs like (servername1,servername2) must be provided.  
  > **username_1**: maybe possible it is have to check or implement or try ...i have not tried it  
  
  ---
  
  