0% found this document useful (0 votes)
122 views

Formula & Cross Object Formula-SFDC

1) A formula field in Salesforce is a read-only field that derives its value from a formula. When the source fields change, the formula field updates automatically. 2) The formula editor allows users to write simple or complex formulas using fields, operators, and functions. It checks the syntax and displays the result. 3) Cross-object formula fields display values from a related object. For example, a formula could display the total number of classrooms in a school object on each related classroom record.

Uploaded by

Niveditha Ch
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views

Formula & Cross Object Formula-SFDC

1) A formula field in Salesforce is a read-only field that derives its value from a formula. When the source fields change, the formula field updates automatically. 2) The formula editor allows users to write simple or complex formulas using fields, operators, and functions. It checks the syntax and displays the result. 3) Cross-object formula fields display values from a related object. For example, a formula could display the total number of classrooms in a school object on each related classroom record.

Uploaded by

Niveditha Ch
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Salesforce-Formula

What is Formula Field in Salesforce?


Formula Field is a read only field that derives its values for the formulla Expression
you define. We cannot Edit Formula Field. When the source field gets changed the
Formula field changes automatically.
Formula Editor and it’s Features:

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.

How to create a formula field in salesforce?


In this training, we are creating a formula field for Customer object. Here, we are going
to create Formula for Tax , When customer purchases more than 30,000 then 10% of Tax
is applied on the Price else 18%.
Syntax: IF( Price__c <=30000, (0.1*Price__c +Price__c ), (0.18*Price__c +Price__c )) As
per from the above Formula , 10% of Tax is applied if Price is <=30000 else 18%.

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.

Now, Let us check the working of Formula Field.



Now, go to Customer Object and create a “New Record” in Customer.

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

What are Cross Object Formula field?


Cross Object Formula field displays one object record in other related object by referencing
merge fields on those objects. Cross-object formulas also work with Lookup relationships.

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

How Cross Object Formula field works?


Now, go to Class Room record and you can check “Total No. of Class Room in School”
is present in every Class Room record as shown in below Fig.10

Fig.10

Hence, You have successfully implemented the Cross Object Formula.

Page 5 of 5

You might also like