1

Validation rule is not working properly. It doesn't let me to save the record with status completed, if I didn't select the two fields. When I select one, it should show the error, that I need to select another one, but in practice, it doesn't show the error and lets me to save the record. OutsideTap__c is picklist, PRVFitted is using the global picklist values.

AND(
ISPICKVAL(Status, "Completed"),
ISBLANK(TEXT(OutsideTap__c)),
ISBLANK(TEXT(PRVFitted__c))
)
1

You need to use OR, not AND.

AND(
  ISPICKVAL(Status, "Completed"),
  OR(
    ISPICKVAL(OutsideTap__c,''),
    ISPICKVAL(PRVFitted__c,'')
  )
)

This is often a confusing point with Boolean logic. OR means "if either condition is true", while AND means "if both conditions are true." In your original formula, the error would only occur if both fields were blank.

3
  • It works, but now, I have a question, how can I put here two profiles, so everything would work AND( ISPICKVAL(Status, "Completed"), OR( ISPICKVAL( WorkOrderCategory__c ,"Softener Installation"), ISPICKVAL(OutsideTap__c,''), ISPICKVAL(PRVFitted__c,''), ISPICKVAL(NonReturnValve__c,''), ISPICKVAL(DrainCompliance__c,''), ISPICKVAL(StaticPressure__c,''), ISBLANK(HACHTestNumberOfDrops__c), ISBLANK(BypassLocation__c), ISBLANK(InstalledLocation__c) ) ) $Profile.Name = "Engineer" || $Profile.Name = "Contracted Engineer"
    – Jekaterina
    Jan 28 at 11:14
  • @Jekaterina You'd add another OR as a last parameter to AND, as follows: AND( ISPICKVAL(Status, "Completed"), OR( ISPICKVAL( WorkOrderCategory__c ,"Softener Installation"), ISPICKVAL(OutsideTap__c,''), ISPICKVAL(PRVFitted__c,''), ISPICKVAL(NonReturnValve__c,''), ISPICKVAL(DrainCompliance__c,''), ISPICKVAL(StaticPressure__c,''), ISBLANK(HACHTestNumberOfDrops__c), ISBLANK(BypassLocation__c), ISBLANK(InstalledLocation__c) ), OR($Profile.Name = "Engineer" || $Profile.Name = "Contracted Engineer") )
    – sfdcfox
    Jan 28 at 12:01
  • Thank you! All works!
    – Jekaterina
    Jan 28 at 15:07

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.