I have this two validation rules
The first to express that if the profile is Profile DS or the profile has the permission set ObligatoryPermission , the field Date must be required .
and for the second it is to express that if the profile is Profile DS OR the profile has the permission set ObligatoryPermission AND the status field which is picklist is terminated , the field Details will be required .
The problem that this is not respected . Some help please
And I have a question , how can I with the validation rule make a field disabled ?
OR(($Profile.Name = "Profile DS"),($Permission.ObligatoryPermission ),
ISBLANK(Date__c )
)
AND(ISPICKVAL(Status__c , "end"), ISBLANK(Details__c ),
OR(($Profile.Name = "Profile DS"),($Permission.ObligatoryPermission )))
Best Answer
Validation rules do their job when the result of the formula is true.
With that in mind, the issue with your current validation rule is that you're
OR()
-ing everything together. From basic boolean algebra, if any condition in anOR()
is true, the entire statement is true. If yourDate__c
is blank, then nothing else matters.To determine what your validation rule should be, it helps to piece it together in plain language first. Remember that the result of your formula needs to be
true
for it to take effect. You're not telling Salesforce when the data is valid, you're telling them when data is invalid.Your plain language description is close, but a simple change will help illustrate what you need to do. I'd lay out your requirement as follows:
You have two things you want to
OR()
, and then you want toAND()
it with the final condition.From that, the formula basically is already written
It's not clear what you mean by "make a field disabled", so I won't touch on that.