Dynamic Dropdowns#

Sometimes, API endpoints require clients to specify a parent object in order to create or access the child resources. Imagine having to specify a company id in order to get a list of employees for that company. Since people don't speak in auto-incremented ID's, it is necessary that Zapier offer a simple way to select that parent using human readable handles.

Our solution is to present users a dropdown that is populated by making a live API call to fetch a list of parent objects. We call these special dropdowns dynamic dropdowns.

Tip: We used to call the dynamic dropdowns "prefills"!

Here is what a user sees as a dynamic dropdown:


In order for a dynamic dropdown to work, we must have a working trigger set up for the parent object. Zapier will query for that dynamic dropdown, parse out an identifier and a human readable handle for each record, and then offer the user a dropdown. Once they make a selection, we store the identifier for use later when reading or writing child objects.

The dynamic dropdown syntax is split into three parts:

  • Which trigger is this dynamic dropdown referring to?
  • Which piece of data is the unique identifier?
  • Which piece of data is a human readable representation?

We combine those into one field: TRIGGERKEY.identifier_key.human_readable_key.

For example, let's say you have a trigger called Project which offers the following data (remember, triggers are expected to return a list of JSON objects with an ID field):

    "id": 4287243,
    "owner_id": 4632,
    "date_created": "Mon, 25 Jun 2012 16:41:54 -0400",
    "title": "My secret project!",
    "description": "It's a Facebook for dogs!"

You want to let users read just the messages from that project as a trigger. As you are making the message trigger you'd need to create a project trigger field with the following dynamic dropdown value:


Note: new_project is a fictional key for the Project trigger. You'll set your specific trigger key when you create your trigger. id is the identifier from the above project data. The human readable representation key title is located there as well.

Notice that a dynamic dropdown is really nothing more than a trigger field/action field that is populated by another trigger.

For fields where it's expected that the value will change, such as an Update Project action where the user will want to update different projects based off the trigger value, we recommend pairing the dynamic dropdown with a search connector. We will prefill the ID from the search into the dynamic dropdown so the customer can easily set this Zap up.

↑ Was this documentation useful? Yes No
Get Help