Professional Documents
Culture Documents
===============
Formula Fields are the ReadOnly System Generated Fields, Whose value will be
generating by Salesforce Automatically based on the specified formula.
Formula fields are not editable by the users. An object can have one or more
formula fields.
While Creating the field inside the object, we have to select the DataType as
"Formula". And while Creating the field, we have to specify the Formula /
Expression to be used to Calculate the value in the field.
Functions:
----------
1. Abs(Number):
- This function returns the Absolute value of the specified number.
2. Sqrt(Number):
It returns the square root value of the given number.
Ex:
sqrt(144) --> O/p: 12
3. Len(string):
It returns an integer value, which indicate the number of characters exist in
the specified string. (Spaces also counted as a character)
Ex:
Len('Welcome To Hyderabad') --> O/p: 20
Len('Welcome') --> O/p: 7
4. Trim():
It removes the blank spaces exist before/ after the specified string.
Ex:
' Welcome '
5. Upper(string):
It converts all the character exist in the string into upper case letters.
Ex:
Upper('welcome') --> O/p: WELCOME.
6. Lower(string)
It converts all the characters exist in the string into Lower case letters.
Ex:
Lower('WELCOME') --> O/p: welcome.
7. Floor(number):
It returns the nearest lower value of the given number.
Ex:
Floor(14.1) --> 14
8. Ceiling(Number):
It returns the nearest higher value of the given number.
9. Left(string,<Number Of Characters>):
It returns the specified number of characters from the Left side of the
string.
Ex:
Left('Welcome',3) --> O/p: Wel
Ex:
Right('Welcome',3) --> O/p: ome
Ex:
Substring('Welcome to Hyderabad',4,5) --> O/p: 'come '
12. Today():
- It returns the Today's system date. (mm/dd/yyyy)
13. Year(Date):
This function will returns the "Year" portion of the specified date.
14. Month(Date):
This function returns the month value of the specified date.
15. Day(Date):
This function returns Date value of the specified date.
By using this function, we can display the images dynamically at time in the
record detailed page.
19. Text(<PicklistFieldName>):
Text function will returns the Currently Selected value from the specified
picklist field.
Note:
While Creating the Formula Field, we have the Select the DataType as
"Formula". Upon Creating the field, we have to specify the "Formula / Expression",
to be used to prepare the value for the field.
1. Currency
2. Number
3. Percent
4. CheckBox
5. Text Type
6. Date
7. Time
8. DateTime
Navigation:
Click on the Required Object's Tab (Ex: Accounts)
1. Click on "View Fields" link.
2. Goto the "Custom Fields & Relationships" section.
3. Click on "New" button.
4. Select the DataType as "Formula".
5. Click on "Next" button.
6. Enter the Formula Field Name, and Description.
7. Select the Formula Return Type. (Ex: Currency)
8. Click on "Next" button.
9. Enter the Formula Conditions inside the Formula Editor.
10. Click on "Check Syntax" button.
11. Click on "Next" button.
12. Select the "Visible" CheckBox, to make the Field to be visible to
all
profile users.
13. Click on "Next" button.
14. Click on "Save" button.
UseCase:
========
Create a Formula Field on the Account Object, to Calculate the 5% of Service
Tax based on the Annual Revenue.
Note: We can Change the Formula field values by changing the Source Field Value.
UseCase:
========
Create a Formula Field on the Account Object, to Calculate the Net Annual
Revenue (After All Deductions)
Note: We can reference One Formula Field inside an another Formula Field.
UseCase:
========
Create a Cross-Object Formula field, to represent the Parent Account Record's
Annual Revenue value into the Related Child Contact Records.