I am developing an integration to a database-like application.
One action is to create a new record with a dictionary of data.
The input form for the New Record Action starts with a question about which Record Type is going to be saved. Based on this value, subsequent form dropdowns ask which field on that Record Type the user wants to set. Another form item (List, with choices) allows the user to select which fields to return from the operation.
Each of these form fields does an API call to ask what fields are available on the selected Record Type, in order to present the list to the user. This is quite inefficient as it basically has to repeat the exact same request multiple times as you set it up.
When the Zap is running, it again does the API request to get the field names, I guess because Zapier is looking at the inputFields structure to query on key, type, etc., and the “choices” list is requested and triggers the API call.
What I would like to be able to do is to query the API for the field list just once, and let ALL the form fields that need that list just refer to the pre-downloaded items.
I can’t see how I would be able to do this – I think I am looking for some sort of instance variable within the Action’s js file, but I don’t know how to go about it.
Can anyone help?
Also, since the New Record Action doesn’t need the full list of fields when the Zap is actually running, is there any way inside the code that generates the “choices” list, if I can determine whether the Zap is actually running live, as opposed to running in setup mode?
Thanks
Stephen