0

I'm at a loss on how to tackle this within the Zapier app.

My JSON return is below:

[
      {
        "id": [
          {
            "id": "1",
            "campaign_name": "Charities"
          },
          {
            "id": "2",
            "campaign_name": "SaaS"
          }
        ]
      }
    ]

I am trying to create a Dynamic Drop Down menu using the results. I've been able to recreate the dynamic dropdown using static values but when I want to access the campaign_name as the label and ID as the id.. I get campaign_name is undefined.

Code I've used as an example for testing:

campaign_name = ([{id: results.id,label: String(results.campaign_name)},

OR

 campaign_name = ([{id: Number(results.id.id[0]),label: String(results.id.campaign_name[0])},

etc. I've tried multiple variations and at a loss.

1 Answers1

0

You need to only return the array from your dynamic dropdown function. return response.data[0].id This makes sure your actual return looks like this:

[
    {
        "id": "1",
        "campaign_name": "Charities"
    },
    {
        "id": "2",
        "campaign_name": "SaaS"
    }
]

Then your field in your component should be this:

{
    key: "key"
    label: "label"
    required: true
    type: "integer"
    dynamic: "drodown_key.id.campaign_name"
}