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
Giancarlo AmatiGiancarlo Amati 

Validation Rules $Object

Hi Everyone,

I am currently reviewing the validation rules on opportunities. I've found the following lines, which I'd like to understand. Within the context of a validation rule which triggers the error only when the rule is True, what does these formulas do? Do they related to "Related Lists" child objects of the opportunity? 

Thank you.

NOT(ISBLANK($ObjectType.Live_Event_Coverage__c.Fields.Live_Event_Allotment_Opportunity__c)), /*allows Live Events to process*/
NOT(ISBLANK($ObjectType.SE_Customer_Solution__c.Fields.Opportunity__c )), /*allows SE Customer Solutions to process*/
NOT(ISBLANK( $ObjectType.Live_Event_Coverage_Timing__c.Fields.CoverageLink__c)), /*allows Live Event Timings to process*/
Best Answer chosen by Giancarlo Amati
Andrew GAndrew G
The Validation is working across the related records.
So line 1 - is looking at the Live_Event_Coverage__c field for the record and then looking at the field on that record Live_Event_Allotment_Opportunity__c to ensure it is not blank.

Similarly the other lines are checking across other related records to check fields on those records.

It is another way of saying : NOT(ISBLANK(Live_Event_Coverage__r.Live_Event_Allotment_Opportunity__c))

Regards
Andrew
 

All Answers

Andrew GAndrew G
The Validation is working across the related records.
So line 1 - is looking at the Live_Event_Coverage__c field for the record and then looking at the field on that record Live_Event_Allotment_Opportunity__c to ensure it is not blank.

Similarly the other lines are checking across other related records to check fields on those records.

It is another way of saying : NOT(ISBLANK(Live_Event_Coverage__r.Live_Event_Allotment_Opportunity__c))

Regards
Andrew
 
This was selected as the best answer
Giancarlo AmatiGiancarlo Amati
That's interesting! so Just so I understand our Opportunity object has the Live Event Coverage object record linked as a child object. So if I write $ObjectType.Live_Event_Coverage__c I am accessing the related lists objects records in this case, the "Live Event Coverage" object record right?
 
Andrew GAndrew G
Short answer is yes.
Help file which casts not a lot of light:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_objecttype.htm

Generally you use the $ObjectType variables when you want to grab things like labels for fields, so it's more for meta-data, but they can return field values also.

Regards
Andrew
Giancarlo AmatiGiancarlo Amati
That's good, thank you very much.
g