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:
If I enter a phone number:
If I enter an email:
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"
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"
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.