Can anybody explain me what does this validation rule does. This is on standard object Account.

NOT($Setup.VRuleSettings__c.HasSubsRTAccess__c )
  • See documentation on the $Setup Global Variable. – Adrian Larson Feb 5 '15 at 15:38
  • you can also use c-style && and || operators. much clearer imo – user38633 Oct 26 '16 at 17:28

The following points all have to resolve to true for the validation rule to trigger an error:

  • Record Type name must be Subcontractor
  • Record must be newly created or the Record Type must have been changed
  • The Custom Setting HasSubsRTAccess__c in VRuleSettings__c must be false for this User (this can be User, Profile or Organization specific)

I'd format it like this. It makes what it does clearer.

AND( OR(RecordType.Name=="Subcontractor"),
NOT($Setup.VRuleSettings__c.HasSubsRTAccess__c )

This is True if the

((record type is subcontractor) AND
(the record is a new one OR the record type ID has changed)) AND
( Not ...HasSubsRtAccess__c is True)

I'm not sure what that last condition means, but if it isn't true, the whole expression will be false. So, ...HasSubsRtAccess__c must be false (because of the NOT) for the whole condition to be True.

  • Its an AND between record type is subcontractor and the record is a new one OR the record type ID has changed not and OR. – BarCotter Feb 5 '15 at 16:04
  • 1
    corrected the logic. I was thrown by the OR with just one argument – Jagular Feb 5 '15 at 16:37

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.