Question

Zapier Static Dropdown Allows Multiple Sending only one value

  • 27 July 2020
  • 3 replies
  • 105 views

I've built a Zapier App on Platform UI that calls a REST service on our domain. The app makes a GET request using a parameter name matchType that accepts a comma or semi-colon delimited array of values. i.e. "IND;HH"

In the app, I've created an Input field with a Dropdown with "Allows Multiple" that maps to matchType and uses the following for the Dropdown Source.

[{ "sample": "IND", "value": "IND", "label": "Individual - Match on first and last name and postal address" }, { "sample": "HH", "value": "HH", "label": "Household - Match on last name and postal address." } ]

My issue is, regardless of how many options I select in the Dropdown, only the first choice makes it into the query string. What I'm expecting is multiple parameters concatenated with a comma because that seems to be what the Zapier documentation suggests. ex: matchtype=IND,HH

Any help would be greatly appreciated.


3 replies

Userlevel 7
Badge +10

Hi @cscirocco! Can I double check something? Where are you selecting the option in the dropdown? Are you testing the Zap in the Zap editor or are you looking at it in the Developer Platform?

 

It’s not possible to select more than one option in a dropdown when you’re in the Zapier editor, so I want to make sure that I understand what you’re trying to do/where you’re looking. Thanks!

Thanks for your response, Danvers. Yesterday, I worked with Zapier support and solved the problem. 

 

The problem is, when you use Allows Multiple Zapier set the value of the parameter to an array and not a string of delimited values like I needed. To solve the issue, I add a bit of javascript to  API Configuration > Configure your API Request > Code Mode.

const reformat_array = function(array){  if(array == null) return "";  return array.join(';');};const options = {  url: `https://myapi.com/${bundle.authData.api_key}/V3/AppendPhone/Residential/?`,  method: 'GET',  headers: {    'Content-Type': 'application/json',    'Accept': 'application/json',    'X-API-KEY': bundle.authData.api_key  },  params: {    'api_key': bundle.authData.api_key,    'firstname': bundle.inputData.firstname,    'lastname': bundle.inputData.lastname,    'address': bundle.inputData.address,    'city': bundle.inputData.city,    'state': bundle.inputData.state,    'postalcode': bundle.inputData.postalcode,    'matchType': reformat_array(bundle.inputData.matchType),    'source': reformat_array(bundle.inputData.source),    'singleBestMatch': bundle.inputData.singleBestMatch,    'suppression': bundle.inputData.suppression,    'test': bundle.inputData.test  }}return z.request(options)  .then((response) => {    response.throwForStatus();    const results = response.json;    // You can do any parsing you need for results here before returning them    return results;    });

Everything is working now, and I would have to say that Zapier support was very responsive and helpful. 

 

Userlevel 7
Badge +10

Hi @cscirocco, thanks so much for sharing the solution with us and I’m glad that the Support Team were able to help you out 🙂

Reply