What is a Cross-Object Formula Field in Salesforce?
A cross-object formula field in Salesforce is a type of bridge field that references fields from different, but related objects.
These fields can merge fields from a Parent or a Master Object or a lookup relationship.
For example, say you want to show a field on the Opportunity as a discount after calculation that’s equal to 15% of the related Account’s “Annual Revenue” field.
Below, let’s review how it can be done.
Cross-Object Formula Example in Salesforce
First, create a “Discount on Revenue” field on the Opportunity Object of Type “Formula” that will return a “Currency” value.
To do this, go to Setup > Object Manager > Opportunity > Field and Relationships > and click “New”.
Select the Data Type “Formula” and click Next.
Enter the Field Label as per the requirement. Name it “Discount on Revenue” and chose the “Currency” Formula Return Type.
Create the Formula
Next, click on Advanced Formula. Then click the Insert Field button and select Opportunity > Account > “Annual Revenue” field, and click Insert.
Now click the Insert Operator button to select the Multiply(*) Operator and manually type “0.15”.
Then click the Check Syntax button under the formula section to validate that the formula doesn’t have any syntax errors.
Finally, click Next > and select “Visible” for all profiles.
Click Next > again and select “Add Field” for all Page Layouts, and then click Save.
Check the Cross-Object Formula Results
Now when you go back and refresh the Opportunity, you will find a field named, “Discount On Revenue” under the Details tab with the discounted value.
The Amount in the “Discount on Revenue” field is $52,500,000.00 because the Account > “Annual Revenue “was $350,000,000.
Note: Remember Formula fields are read only for everyone.
Additional Resources
- Salesforce Help: What is a Cross-Object Formula?
- Salesforce Help: Tips for Building Cross-Object Formulas
Cover Photo by Max Bender on Unsplash