function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dlattedlatte 

Help with Formula fields with nested OR condition

Advanced Formula question:

This formula works fine.  It checkes the country is CN, or JP, or KR.  Then it checks if any of the fields are blank.  This works fine:
IF(OR (ISPICKVAL ( MailingCountryCode , "CN"), 
ISPICKVAL(MailingCountryCode, "JP"), 
ISPICKVAL(MailingCountryCode, "KR")), 
(IF( ISBLANK( First_Name_Latin__c ) , 0, 1) + 
IF( ISBLANK( Last_Name_Latin__c ) , 0, 1) + IF( ISBLANK( Job_Title_Latin__c ) , 0, 1) + 
IF( ISBLANK( Department_Latin__c ) , 0, 1) + IF( ISBLANK( City_Latin__c ) , 0, 1) + IF( ISBLANK( Title ) , 0, 1) + 
IF( ISBLANK( Department ) , 0, 1) + IF( AND(ISBLANK(Phone),ISBLANK(MobilePhone)), 0, 1)) / 8, 1)


My question:
The Title, Department, and (Phone,MobilePhone ) fields need to be check regardless of the Country.
How can I modify the above Advanced Formula for this?     




The second condition is *not* dependent on the country, and only 3 fields are blank.

 
srlawr uksrlawr uk
hmm. I see what you are doing there in the existing formula, complicated!

to be fair, off the top of my head (on a Friday afternoonb, right!) something like this would serve your need...
 
OR(

IF(
OR (
	ISPICKVAL ( MailingCountryCode , "CN"), 
	ISPICKVAL(MailingCountryCode, "JP"), 
	ISPICKVAL(MailingCountryCode, "KR")
), 
(
IF(ISBLANK( First_Name_Latin__c ) , 0, 1) + 
IF( ISBLANK( Last_Name_Latin__c ) , 0, 1) +
IF( ISBLANK( Job_Title_Latin__c ) , 0, 1) + 
IF( ISBLANK( Department_Latin__c ) , 0, 1) + 
IF( ISBLANK( City_Latin__c ) , 0, 1) +
IF( ISBLANK( Title ) , 0, 1) + 
IF( ISBLANK( Department ) , 0, 1) +
IF( AND(ISBLANK(Phone),ISBLANK(MobilePhone)), 0, 1)
) / 8, 1),
ISBLANK( Title ),
ISBLANK( Department ),
ISBLANK(Phone),
ISBLANK(MobilePhone))

Though it could probably be done tidier than that I would imagine... that's not bad for free ;)
 
srlawr uksrlawr uk
hmm. that said.. re-examining your code, do you currently not allow any records through at all if they are not CN, JP or KR? because the "else" of the if statement is just "1" - which will throw the validation error?
dlattedlatte
Thank you for the re-examining question.  I will tighten up the logic to check if the MailingCountryCode is blank.

I will continue to work with the logic you provided, currently check syntax if failing:
 Error: Incorrect parameter type for function 'OR()'. Expected Boolean, received Number

My logic is following the pattern I found in: 
https://success.salesforce.com/answers?id=90630000000gidlAAA