1

I have a validation rule which check's field value (lookup) is "study" then it validates child object field DATE Should be within 90 days from today
below is the validation rule

IF($ObjectType.Project__c.Fields.Status__c ='Study' && Date__c <= TODAY()+90 ,TRUE,FALSE)

But it's not working. Why?

1
  • Hi Alex, please take a moment to visit the help center and read How to Ask. You should really be more specific than "not working" whenever possible. Does it fail to compile? Are you getting an error message? Also note, for Boolean values you can always replace IF(condition, true, false) with simply condition. They're the same.
    – Adrian Larson
    Jan 4, 2017 at 14:22

1 Answer 1

3

The $ObjectType notation is for accessing the Schema level information about a Field (such as api name, label etc.), and not the values of that field within a record? I think you have perhaps confused this with using a lookup.

From the information you have provided I would imagine you are after something more like:

IF(Project__r.Status__c ='Study' && Date__c <= TODAY() + 90, TRUE, FALSE)

Or, more succinctly:

Project__r.Status__c ='Study' && Date__c <= TODAY() + 90

This assumes the lookup is called "Project__c" (though note the use of the 'r' to navigate the relationship).

You must log in to answer this question.

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