1

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

AND(
OR(
RecordType.Name=="Subcontractor"
),
OR(
ISNEW(), 
ISCHANGED(RecordTypeId)
),
NOT($Setup.VRuleSettings__c.HasSubsRTAccess__c )
)
2
  • See documentation on the $Setup Global Variable.
    – Adrian Larson
    Commented Feb 5, 2015 at 15:38
  • you can also use c-style && and || operators. much clearer imo
    – user38633
    Commented Oct 26, 2016 at 17:28

2 Answers 2

3

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)
0
1

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

AND( OR(RecordType.Name=="Subcontractor"),
OR(ISNEW(), ISCHANGED(RecordTypeId)),
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.

2
  • 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
    Commented Feb 5, 2015 at 16:04
  • 1
    corrected the logic. I was thrown by the OR with just one argument
    – Jagular
    Commented Feb 5, 2015 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .