function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Stephen Glaros 7Stephen Glaros 7 

Date Validation Rule between Two Objects?

Hi all - I'm trying to create a validation rule where the date of a child record can't exceed the date of the master record.  In other words, if the master record had an end date of 7/30/19, the child record cannot have an end date of 7/31/19.

The error I get is: Error: Incorrect parameter type for operator '>'. Expected Date, received Object

This is what I tried: Implementation_Date_Best_Case__c > $ObjectType.Project_Detail__c.Fields.Project_End_Date__c

Any ideas? I'm thinking it's a validation rule but if it's another function, any advice would be appreciated. thx!
Best Answer chosen by Stephen Glaros 7
Maharajan CMaharajan C
Hi Stephen,

You are traversing in wrong way to get the Project_End_Date__c in  Validation Rule .

 $ObjectType.Project_Detail__c.Fields.Project_End_Date__c  ==>   Wrong

It should be Like Below:

 Project_Detail__r.Project_End_Date__c

below am using the Project Task (Child Object)  ==> Project (Parent Object)  for your reference.

User-added image



Thanks.
Maharajan.C

All Answers

Maharajan CMaharajan C
Hi Stephen,

You are traversing in wrong way to get the Project_End_Date__c in  Validation Rule .

 $ObjectType.Project_Detail__c.Fields.Project_End_Date__c  ==>   Wrong

It should be Like Below:

 Project_Detail__r.Project_End_Date__c

below am using the Project Task (Child Object)  ==> Project (Parent Object)  for your reference.

User-added image



Thanks.
Maharajan.C
This was selected as the best answer
Kunal KaushikKunal Kaushik
Implementation_Date_Best_Case__c > Project_Detail__r.Project_End_Date__c

 
Stephen Glaros 7Stephen Glaros 7
Thank you both Maharajan.C & Kuinal for taking the time to answer my question!