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?

1 Answer 1

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
    Commented Mar 17, 2020 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
    Commented Mar 18, 2020 at 3:06

You must log in to answer this question.

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