Cross-Object Formulas in Salesforce

By in
8970
Cross-Object Formulas in Salesforce

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”.

Salesforce New Field

Select the Data Type “Formula” and click Next.

Create Formula Field

Enter the Field Label as per the requirement. Name it “Discount on Revenue” and chose the “Currency” Formula Return Type.

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.

Advanced Formula Salesforce

Now click the Insert Operator button to select the Multiply(*) Operator and manually type “0.15”.

Create Cross Object Formula Salesforce

Then click the Check Syntax button under the formula section to validate that the formula doesn’t have any syntax errors.

Check Formula Syntax

Finally, click Next > and select “Visible” for all profiles.

Visible

Click Next > again and select “Add Field” for all Page Layouts, and then click Save.

Add Field

 

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.

Cross Object Formula Field

The Amount in the “Discount on Revenue” field is $52,500,000.00 because the Account > “Annual Revenue “was $350,000,000.

Account Annual Revenue

 

Note: Remember Formula fields are read only for everyone.

 

Additional Resources

Cover Photo by Max Bender on Unsplash

Leave a reply

Your email address will not be published. Required fields are marked *