Salesforce: Cross-Object Formulas

Cross-object formulas are formulas that span two related objects and reference merge fields on those objects. Cross-object formulas can reference merge fields from a master (“parent”) object if an object is on the detail side of a master-detail relationship. Cross-object formulas also work with lookup relationships.

To create a cross-object formula when building a formula, enter the relationship names of the objects to which you are spanning followed by the field you want to reference. Separate the relationship names of each object and the field with periods.

For example, enter Contact.Account.Name to reference the Account Name for a contact associated with a case in a formula field on the Case object. Be sure to use the relationship names of the objects, not the labels. Although the relationship name is often the same as the object name, it is technically the field name of the relationship field.

To reference the parent account name from Account object, the syntax is Parent.Name, not Account.Name. When referencing a custom object, add two underscores and the letter r to its name. For example, Position__r.title__creferences the Job Title field (title__c) on a Position custom object.

You can reference fields from objects that are up to 10 relationships away. Cross-object formulas are available anywhere formulas are used except when creating default values.

If you create a formula that references a field on another object, users can see the field on the object even if they don’t have access to that object record. For example, if you create a formula field on the Case object that references an account field, users can see this field even if they don’t have access to the account record.

Below are some Tips
Formula fields can expose data that user do not have access, such as:
– user do not have access to the field level security within the same object
– cross-object where user do not have access to the record- cross-object where user do not have access to the record and the field- cross-object where user do not have permission to the object

Roll-Up Summary Field
If a roll-up summary field doesn’t contain cross-object field references or functions that derive values on the fly, such as NOW or TODAY, it can calculate the values of formula fields.

Permanent link to this article: https://salesforcebuddy.com/2019/01/salesforce-cross-object-formulas/

Leave a Reply

Your email address will not be published.