Skip to main content
I'm trying to do a simple validation rule to set a field to a particular viable when country and USC type are selected. 

 

IF( AND(ISPICKVAL(Country__c, "USA"), ISPICKVAL(USC_Type__c, "US - DoD/VA")) , 

 

Report_Classification_B__r.Report_Classification_Code_DoD__c , 

 

IF ( AND(ISPICKVAL(Country__c, "USA"), ISPICKVAL(USC_Type__c, "US - Vizient")) , 

 

Report_Classification_B__r.Report_Classification_Code_Vizient__c , 

 

The above works but the moment I added the below to it, it triggered the error message

 

IF( AND(ISPICKVAL(Country__c, "USA"), ISPICKVAL(USC_Type__c, "US - Other")) , 

 

Report_Classification_B__r.Report_Classification_Code_US_Other__c ))

 

Not sure what the problem is - your help is much appreciated 

 

 
9 respuestas
  1. 27 feb 2019, 11:50
    No problem - it's just that you forgot to replace both

    of the empty string instances with the default value. Let's try this:

    IF (ISPICKVAL(Country__c, "USA"),

    CASE(USC_Type__c,

    "US - DoD/VA", Report_Classification_B__r.Report_Classification_Code_DoD__c,

    "US - Vizient", Report_Classification_B__r.Report_Classification_Code_Vizient__c,

    "US - Other", Report_Classification_B__r.Report_Classification_Code_US_Other__c,

    Text(Report_Classification_B__r.Report_Classification_Code__c)

    ),

    Text(Report_Classification_B__r.Report_Classification_Code__c)

    )

    The first one is for everyone in the USA with an unknown USC type, and the other is for everyone outside the USA. I know you'd only need to have it once if you had used an IF, but in terms of the performance required to calculate the formula, this is more efficient.

     

     
0/9000