I'm building a Zapier app for a platform that have dynamic fields. I have an API that returns the list of fields for one of my resource (for example) :
[
{ name: "First Name", key: "first_name", type: "String" },
{ name: "Civility", key: "civility", type: "Multiple" }
]
I build my action's inputFields
based on this API :
create: {
[...],
operation: {
inputFields: [
fetchFields()
],
[...]
},
}
The API returns type that are list of values (i.e : Civility), but to get these values I have to make another API call.
For now, what I have done is in my fetchFields
function, each time I encounter a type: "Multiple"
, I do another API call to get the possible values and set it as choices
in my input field. However this is expensive and the page on Zapier takes too much time to display the fields.
I tried to use the z.dehydrate
feature provided by Zapier but it doesn't work for input choices
.
I can't use a dynamic dropdown here as I can't pass the key of the field possible value I'm looking for. For example, to get back the possible values for Civility, I'll need to pass the civility
key to my API.
What are the options in this case?