0

I need to compare one date field (Date/Time) with Parent Objects Date field(Date/Time). When these two values are not equal then need to fire validation rule.

Formula:

DATEVALUE( CallDateTime__c ) <> ( $ObjectType.CallPresentation__c.Fields.OCE__OffCreatedDate__c )

DATEVALUE function is not working for $ObjectType.CallPresentation__c.Fields.OCE__OffCreatedDate__c

Now i need to compare both as Dates. Can anyone please suggest me how to convert date/time to date when we use sobject formula?

3

The $ObjectType global gives you access to refer to elements of your Salesforce org's schema. It does not provide access to cross-relationship data, or any data at all in actual records; it only yields information about the objects and fields in the org.

If your object has a field Relationship__c, you'd refer to its fields in a validation rule via the standard Relationship__r.Some_Field__c notation for traversing relationships.

2
  • Ok David, But i need to write validation rule on Parent object. there is a lookup relationship. How do we write validation rule on Parent object? I think Process builder or trigger will work right?
    – Frank
    Mar 17 '20 at 5:27
  • You can't write a validation rule on a parent object that references child objects unless the parent object also has a lookup relationship to the child (i.e, you have a circular reference.
    – David Reed
    Mar 18 '20 at 3:06

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.