How to make Email and Primary Phone fields mandatory in contact?

You can add email addresses for accounts or contacts using the respective UI pages or REST APIs. While entering these email addresses, the format of the email address should be validated.

You can use Groovy scripts to specify the rules to validate email address and phone number formats.

For more information on Groovy scripting, see Oracle Applications Cloud Groovy Scripting Reference guide. For more information about REST APIs, see the REST API for CX Sales and Fusion Service guide.

The following code is a sample for validating email addresses and phone numbers:

def tCPhone = Phone;
tCPhone?.reset();
def noPhone = true;
println("Phone1" + tCPhone);
def RawPhNumber;
def PhNumber;
def emailaddr

while( tCPhone.hasNext())
{
      def tCphoneRecord = tCPhone?.next();
      println('Phone' + tCphoneRecord );
      PhNumber = tCphoneRecord?.PhoneNumber;
      println('PhoneNum' + PhNumber );
      RawPhNumber = tCphoneRecord?.RawPhoneNumber;
     // println('RawPhoneNum' + RawPhNumber );
     if((PhNumber != null || RawPhNumber != null) && tCphoneRecord?.Status == 'A') {
            noPhone = false;
           break;
    }
}

def noEmail = true;
def emailiter = Email;
emailiter.reset();
def val = PrimaryEmailAddress
println("PrimaryEmail"+ val);
while(emailiter.hasNext())
{
    def emailrow = emailiter.next();
    //println('email' + emailiter);
    emailaddr = emailrow?.EmailAddress
    if(emailaddr != null){
         noEmail = false;
        break;
    }
}

if(noPhone && noEmail){
 
 throw new oracle.jbo.ValidationException('Phone number or Email required' + RawPhNumber + ': ' + PhNumber + ': ' + emailaddr);
}
return true;