Skip to main content
Best answer

Multiple-entry input fields


craibuc
Forum|alt.badge.img

What this the syntax for creating an input field, using the CLI  environment, that allows for multiple values to be supplied?

inputFields: [
  {
    key: 'FileID',
    label: 'File ID',
    type: 'string',
    helpText: "The IDs of the files to be retrieved.",
    required: true,
    multiple: true,  // ?
    list: false,
    altersDynamicFields: false,
  },
],

When this field is posted, how are multiple values denoted?  A comma-delimited string or an array of strings?

bundle.inputData.FileID = 'A','B'

// OR

bundle.inputData.FileID = ['A','B']

 

Best answer by connorzBest answer by connorz

Hey @craibuc ,

Great question!

In the CLI, the relevant property is list

When list: true, the user is able to provide multiple values, and Zapier will store them in an array:

For example, a field like this…

{
  key: "fruits",
  label: "Fruits",
  helpText: "Enter some fruits",
  list: true
}

...would present like this in the editor (where a new input appears after each entry)…

 

...and by default, bundle.inputData.fruits would be passed as an array:

["Apple", "Grape", "Watermelon"]

 

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Forum|alt.badge.img+7
  • Zapier Staff
  • 91 replies
  • Answer
  • July 24, 2023

Hey @craibuc ,

Great question!

In the CLI, the relevant property is list

When list: true, the user is able to provide multiple values, and Zapier will store them in an array:

For example, a field like this…

{
  key: "fruits",
  label: "Fruits",
  helpText: "Enter some fruits",
  list: true
}

...would present like this in the editor (where a new input appears after each entry)…

 

...and by default, bundle.inputData.fruits would be passed as an array:

["Apple", "Grape", "Watermelon"]

 


craibuc
Forum|alt.badge.img
  • Author
  • Beginner
  • 8 replies
  • July 24, 2023

If only one value is supplied, is it an array of one item?


Forum|alt.badge.img+7
  • Zapier Staff
  • 91 replies
  • July 24, 2023

Hey @craibuc ,

Yes, if only one value is supplied, it’s formatted as an array of one item. 

For example, here...

bundle.inputData.fruits has a value of [ 'Apple' ]