Question

Sharing "choices" between two different inputField dropdowns

  • 2 March 2023
  • 1 reply
  • 40 views

Userlevel 1

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


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 1

Update: I realised that I should be using Dynamic fields (triggers used to populate dropdown lists) for the majority of my fields. That stopped the additional API requests taking place during Zap runs, though it has slowed down the process of editing the Zaps, because the API call is made every time a new dropdown (in a list) is edited.

However, I still have an issue with one case: I do an API call when constructing a “copy” (help text) field, to retrieve the descriptions of the chosen fields. Clearly there is no need to retrieve this during a Zap run, but because it is an InputField it generated every time the Zap runs.

I don’t believe I can make use of Dynamic fields in the construction of “copy” fields. I also looked through the bundle.meta properties to see if there are any that indicate that the zap is being run, but I don’t think any do. You can detect isLoadingSampleisFillingDynamicDropdown and isPopulatingDedupe, but I don’t think any of those can be used within a “copy” field to detect a live zap run.