3

Since I have gotten great assistance previously, thought I'd request more assistance with yet another validation rule. I get no syntax errors and the validation rules fires but only when all fields referenced are null. Here is what the business wants: If there is nothing in the DB Manufacturer field, and the sub type is EBR/EFR Needs Office Review then • EITHER Boiler Type OR Furnace Type needs to be input • Both of the following fields need to be supplied: MFG Year Fuel Type

This is what I have created:

DB_Manufacturer__c  = ""  && 
ISPICKVAL(Sub_Type__c, 'EBR/EFR Needs Office Review') && 
ISPICKVAL(Boiler_Type__c, '') && 
ISPICKVAL(Furnace_Type__c, '') && 
(ISBLANK(MFG_Year__c) || 
 ISPICKVAL(Fuel_Type__c, '') || 
 ISBLANK( Manufacturer__c ))

Once I select a Boiler Type and no other fields, the validation rules no longer fires. There has to be something with my grouping or AND's and Or's. Any assistance is appreciated.

2

I'd translate the business's functional requirement into an error statement. Instead of

We need to ensure that A is set to B and C is set to D

It has to be thought of as

Throw an error when A != B or C != D

I believe this sufficiently marks the error conditions in your scenario. Instead of:

If there is nothing in the DB Manufacturer field, and the sub type is EBR/EFR Needs Office Review then • EITHER Boiler Type OR Furnace Type needs to be input • Both of the following fields need to be supplied: MFG Year Fuel Type

Here's how it looks translated into when an error should occur:

Throw an error when (DB Manufacturer is blank) and (sub type is EBR/EFR Needs Office Review) and EITHER ((BOTH Boiler Type AND Furnace Type are blank) or (MFG Year is blank) or (Fuel Type is blank))

Then translating that to a validation rule is simple:

AND(ISBLANK(DB_Manufacturer__c),
    ISPICKVAL(Sub_Type__c, 'EBR/EFR Needs Office Review'),
    OR(AND(ISPICKVAL(Boiler_Type__c, ''),
           ISPICKVAL(Furnace_Type__c, '')),
       ISBLANK(MFG_Year__c),
       ISPICKVAL(Fuel_Type__c, '')))

You had another line for Manufacturer, not sure if that was an additional requirement, but the statement above should throw an error when you want it to do so.

| improve this answer | |
  • 1
    yes, thank you. this is what I ended up using: DB_Manufacturer__c = "" && ISPICKVAL(Sub_Type__c, 'EBR/EFR Needs Office Review') && (ISPICKVAL(Boiler_Type__c, '') || ISPICKVAL(Furnace_Type__c, '')) && (ISBLANK(MFG_Year__c) || ISPICKVAL(Fuel_Type__c, '') || ISBLANK( Manufacturer__c )) Which appears to be the same, just displayed differently. Thank you for taking the time to explain how to work it through as well. It's that EITHER part that always gets me when trying create a formula--I don't know what the syntax is. Thanks again! – user7417 Jun 9 '14 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.