Creating Dynamic Field Selection for Zapier Actions Based on Trigger Source

I’m building a custom Zapier integration and running into issues with one specific feature.

Here’s my setup: Users pick any trigger they want (like Google Sheets or Airtable) and then select my app as the action. My action called “Send to MyApp” needs two input fields:

  1. Target Selection - This works fine. I create a dynamic dropdown by returning JSON data from my API
  2. Field Mapping - This is where I’m stuck. I need users to pick which data fields from their chosen trigger should be sent to my app

The tricky part is that I don’t know ahead of time what trigger app they picked or what fields it provides. But I still want them to select multiple variables from whatever source they chose.

I’ve seen other apps like Webhooks by Zapier do something similar where they let you map fields dynamically.

Is there a way to build this kind of field selector? Even better if I could set limits on how many fields they can pick (like minimum 1, maximum 5).

What’s the right approach for implementing this dynamic field mapping?

Been there, done that. Zapier’s trigger field subscription approach works great for this. Don’t try to generate fields dynamically after setup - create a field type that subscribes to the trigger’s output bundle instead. Build a custom field using bundle.inputData with error handling for incomplete trigger setups. I used a multi-select field that pulls available options from the trigger’s sample data via bundle.cleanedRequest. Handle field count validation server-side in the perform method, not in the UI. Watch out though - some triggers give inconsistent sample data, so handle empty or broken trigger outputs gracefully. Test across different trigger types since every app structures output differently.

Use computed fields in your action’s input schema. Create a field that grabs data from the previous trigger step with Zapier’s bundle.inputData. In your perform function, loop through bundle.inputData to pull the field names and show them as checkboxes or a dropdown. For those field limits, add validation in your perform function that checks how many fields are selected. Throw an error if it’s not between 1-5. I use z.object with custom validation - works great for this stuff. Heads up though: some triggers have wonky field structures, so handle cases where the trigger data is empty or broken when you’re testing.

for dynamic field mapping, try using zapier’s inputFields. u gotta write a function that reads the trigger app’s output and generates fields dynamically. also, the cli docs on dynamic dropdowns have nice examples. handling limit validation can also be done in your perform function.