Best answer

At least one field required


Userlevel 1

Hey, I want to create an Action in which at least 1 out of 2 (either one or both) fields should be required. How do I set it up? I have searched the forum but am not finding any way to achieve this combination.

 

Truth table:

 

Field 1 Field 2 Validation
Empty Empty Failed
Filled Empty Passed
Empty Filed Passed
Filled Filled Passed

 

icon

Best answer by GetUWired 7 July 2022, 14:47

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.

4 replies

Userlevel 7
Badge +9

Hey @masterAkayMOE! Are you looking to do this with an app you’re adding to the developer platform or within a Zap you’re building? If the ladder, generally, the best way to implement conditions like these would be to use a Filter step or a Path:

Let us know!

Userlevel 1

Hey! Thank you for the swift response. I'm looking to do this with an app that I'm developing on the Zapier Platform.

Userlevel 7
Badge +12

Hi @masterAkayMOE 

You can mark fields required https://platform.zapier.com/docs/input-designer#required 

However, if you only want some logic and both fields aren’t necessarily required, i often see people put helpText to communicate to the end user that one of the fields must be filled out. Then in your code, validate that rule.. if neither field was filled out you can throw an error alerting the zapier user. 
https://platform.zapier.com/cli_docs/docs#zerrors 

Userlevel 6
Badge +8

Hi @masterAkayMOE,

@GetUWired is correct here. There’s nothing in the platform build for exactly this situation. Most people address it with clear help text. If the user leaves them both blank, your API should, of course, return an error and that will be passed on to the user. We have more documentation on error handling here.

Let us know if you have any more questions!