Best answer

Input field for getting an object by id or name

  • 26 June 2023
  • 3 replies
  • 266 views

Userlevel 1

The action is to update a Project. We want the user to be able to pass in the project id or the project name, since in our case project names are unique. 

Currently, we have two fields, one for the id and the other for the name. We have help text that says “Use this field only if the name field is empty” and a similar message on the other field. 

I think I have seen another zap integration that let the user switch between the two options in a single field but I am not seeing how to do that. 

Ideally we have the user choose which of the options they like in one field, instead of two. I know I could just use one field for both and do the check on the backend, but that would require doing the search for id and then searching for the name if id doesn’t turn up anything, but it would be nice to have a field that I could use that didn’t need that. 

icon

Best answer by connorz 26 June 2023, 23:08

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.

3 replies

Userlevel 3
Badge +6

Hey @skyvewire , 

Great question!

From your description, this might be a good fit for the platform’s dynamic field functionality:

For example, you could have one field that asks the user what they want to pass, a name or id. That could be a static dropdown, like below, and importantly, you’d want to make sure that the “Alters Dynamic Fields” box is checked:

 

Then, in the dynamic field, we can check the value of the of first field, referencing it by its key, and conditionally render the corresponding field:

 

Of course, your fields might be more or less complex, but does this give you an idea of how you might approach it?

 

Userlevel 1

That is great! I have one of my fields, id, a dropdown field with dynamic data. The dynamic data I want to come from my already existing trigger. I can’t quite grasp how to do that. 

Userlevel 1

I actually got it figured out from another persons answer! Thanks!