Best answer

Default value for a dynamic input field - Can it be dynamic as well?

  • 27 October 2022
  • 6 replies
  • 434 views

Userlevel 1
Badge +1

We have a couple of dynamic input fields in our Zapier app actions. While testing the usability I’ve run over the case that I always need to make a selection from the dropdown list. Often there is a sane default throught.

Therefore we were wondering if the `default` setting could not be set to one.

Looking into the schema[1] it says the default is a string, so it looks like if it is static.

Is there a way to make it dynamic other than providing a special value the Zapier app imlpementation knows and would handle it then?

Additional context: The field has the `dynamic` property and is `required: True`.

 

[1]: /FieldSchema: https://github.com/zapier/zapier-platform/blob/master/packages/schema/docs/build/schema.md#fieldschema

icon

Best answer by toktok 31 October 2022, 16:03

View original

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

6 replies

Userlevel 6
Badge +8

Hi @toktok ,

You should definitely be able to set the default of a dynamic field. Have you tried to do that and not been able to do it?

Userlevel 1
Badge +1

Howdy @shalgrim , yes the default can be set to a static value. But my question is about dynamic values of the default (e.g. a functionSchema or similar). Do you have an idea about that?

Userlevel 6
Badge +8

Hm, I don’t think I fully understand how a default could be dynamic. Do you have a more specific example of how a default could be dynamic?

Userlevel 1
Badge +1

The dynamic offers a list of valid values and one of those dynamic values should be used as default value (e.g. the topmost one).

Userlevel 6
Badge +8

Hm…

The help docs state that default is “A default value that is saved the first time a Zap is created.”

Have you tried setting the value of that key to the output of a function that makes an API call (or whatever it is you’re doing to generate the dynamic list) and returning the topmost item?

Userlevel 1
Badge +1

I’d need to verify if it works in this case. Saved first time it’s created, to see what that means and if possible after all to defer it to some function return incl. promise. I’ll check and then report back, but may take a bit of time until.