Formula & Cross Object Formula-SFDC
Formula & Cross Object Formula-SFDC
Fig.1
In Salesforce Editor, We use different elements while creating various Formula fields. As
show in above Fig.1 we have noted various elements. They are as follows:
✓
Simple Formula: Is a Tab, where we use to write simple formula without Functions
✓
Advanced Formula: Is a Tab, where we use to write complex formula using pre-
defined Functions.
✓
Text Area: Is the space where we write Formula expression.
✓
Insert Field: It allows user to select fields to use in the Formula expression.
✓
Insert Operator: Insert Operator display list of all Mathematical and Logical
operators present in Salesforce.
✓
Functions Menu: Using functions menu we insert formula functions like AND,
ISBLANK, ISPICKVAL, OR etc.
✓
Check Syntax: To check the formula syntax is valid or not.
Page 1 of 5
Salesforce-Formula
Now, Go to Setup | Build | Object | Customer . Then Click on “New” button in Custom
Fields & Relationships Related list as shown in below Fig.2
Fig.2
Step 1: Choose the field type as Formula and Click Next as shown in below Fig.
Fig.3
Step 2: Now, Select Currency as Formula Return Type and Enter the Field Label and
Field Name and click on “Next” as shown in below Fig.4
Fig.4
Page 2 of 5
Salesforce-Formula
Step 3: Enter Formula as shown in above Formula editor as shown in above Fig.1.
Finally save all the settings as explained in Training.
Fig.5
✓
As shown in above Fig.5. The Price given is 100$.
Fig.6
✓
When the Record gets Saved, as shown in the above Fig.6.You will see a Formula
Field “Total Price Including Tax” the value is calculating based on the Price field.
Adding 10% to the Price value if Price is less than or equal to 30,000$.
✓
We have successfully implemented Formula field.
Page 3 of 5
Salesforce-Formula
Example: If Class Room is related to another object(School) then you can pull the fields
value from the another object and populate the value in Class Room.
School is the parent object of Class Room. If you want to pull “Total No. of ClassRoom
in School” value for every Class Room record then you should implement this by using
Cross Object Formula field. We can create “Total No. of Class Room in School” in Class
Room record.
Merge Fields: A merge field is a field you can put in a formula to incorporate values
from a record. For e.g: See in below e.g
How to create Cross Object Formula field?
Now, Go to Setup | Build | Create | Object | Class Room | Custom Fields & Relationships
related list and click “New”.
Step 1: Choose the field type as Formula and Click “Next” as shown in above Fig.
Step 2: Now, Select “Number” as Formula Return Type and Enter the Field Label and
Field Name and click on “Next” as shown in below Fig.7
Fig.7
Step 3: On “Advanced” Tab Click on “Insert Field” button Class Room> School> Total
No. of Class Room and Click “Insert” as shown in below Fig.8
Page 4 of 5
Salesforce-Formula
Fig.8
Note: “School>” will list the no. of Fields of School object where School is the Field in
Class Room object.
✓
Now, Click on “Next” button as shown in below Fig. and Save all the settings as
explained in Training.
Fig.9
Fig.10
Page 5 of 5