What?
A really quick article on a pretty cool requirement, making 2 fields mandatory but if one is completed then making the other optional.

Why?
My use-case is that the mobile or email field on a Zoho CRM contact record is used to authenticate the contact on a Wordpress portal. OTP or 2FA or MFA or OTC is in effect however; so a contact email OR phone number is required. Both aren't required but at least one should be.

How?
We can do this without code and only using ZohoCRM layout rules. Let's take a contact record for demo purposes:
ZohoCRM: Make either Mobile or Email mandatory: As it appears first

If I enter a phone number:
ZohoCRM: Make either Mobile or Email mandatory: If phone entered

If I enter an email:
ZohoCRM: Make either Mobile or Email mandatory: If email entered

And then let's specify a couple of layout rules to enforce this:
  • Login as a ZohoCRM Administrator, go to Setup > Modules > Contacts > Layout Rules > New Layout Rule
  • Call it "If Email Blank then Mobile Required"
  • Select the Email field as the primary field to control this rule
  • Set the condition that the email "is empty" > click on the "Next" button
  • Set Mandatory FIelds > and select "Mobile"
ZohoCRM: Make either Mobile or Email mandatory: First Layout Rule
ZohoCRM: Make either Mobile or Email mandatory: Set phone mandatory

Repeat these steps to add another rule:
  • Call it "If Mobile Blank then Email Required"
  • Select the Mobile/Phone field as the primary field to control this rule
  • Set the condition that the Mobile "is empty" > click on the "Next" button
  • Set Mandatory FIelds > and select "Email"
ZohoCRM: Make either Mobile or Email mandatory: Second Layout Rule
ZohoCRM: Make either Mobile or Email mandatory: Set email mandatory

Caveat(s)
  • You will get a warning that you are selecting a field that is already being used in a rule. Seems that I can't select the same field in a third layout rule...

Easy without coding and probably everyone figures this one out but I thought I'd add it here as I thought it was pretty cool.