Skip to main content

Hi there,

 

Apologies for my newbie question.

My users accounts will have “Campaigns” and they can then use the Zap to send CRM data to my platform but linked to a campaign. I am wanting to create an action where it displays a list of the campaigns, user chooses, then assign additional details i.e first name, address etc. The user inputted info will be then sent to my backend with the Zap etc.

 

I am able to use a hidden trigger to locate the campaigns i.e below:

 

What I’ve done so far:

  1. Created a hidden trigger that retrieves the details - as above
  2. Assign names on output fields ‘campaign_name’ & ‘Campaign Name’
  3. Created an action, selected Input fields - Dynamic Dropdown. Assigned the details as per below 

     

  4. I run the test Zap, it says no results - I’m at a loss at what I’m doing wrong? 

     

Does the trigger automatically run prior to the action being a dynamic field or am I doing something completely wrong?

 

Thanks

Steve

HI @stevep 

You have a couple of problems going on. 

Zapier schema dictates that you return an array of objects from a trigger not a nested array of objects. 
ie >{‘campaign_name’: ‘Charities’},{‘campaign_name’: ‘SaaS’}] and not {‘campaign_name’: ‘Charities’},{‘campaign_name’: ‘SaaS’}]].

 

The other issue i see is that Zapier requires all triggers to return an id field in the object. You will need to map over the array to create an id field

return ARRAY.map(object => {
   object.id = object.campaign_name;
   return object;
})


Thank you so much. That’s now worked!

 

I’ve now been able to create a dynamic field to be created based off that drop down. However, I can’t seem to map the ID and the Label to the dynamic dropdown.

  • the response back is a letter_name : “Sample” and id : “1” etc but I can’t for the life of me get it included in the choices as the value. 

 const results = z.JSON.parse(response.content);      
      const field = { label: 'Letter Name', key: 'letter', choices: results.map(x => xe'letter_name']) }
      z.console.log(`here is the dynamic field: ${JSON.stringify(field)}`)
      return field;


If I use the scheme (https://zapier.github.io/zapier-platform-schema/build/schema.html#fieldschema) as follows like:

 

 const field = { 
        label: 'Letter Name', 
        key: 'letter', 
        choices: { label: String(results.map(x => xl'letter_name'])),
        sample: results.map(x => xr'letter_name']),
        value: results.map(x=>xv'letter_id'])}] }
        

My output is 

 


Fixed!! https://community.zapier.com/developer-discussion-13/can-you-refresh-fields-based-on-dynamic-field-selection-14071


Not sure how to unselect my own answer as best answer - mistake.