What is a Formula Field in salesforce?

Formula Field ia a read only field, that value of formula field evaluate from expression defined by us. If we update any value in the expression, it automatically updates formula field value. We can create formula field in both standard and custom objects.

For Example1:-
If monthly income more than 500/- then yearly income will be calculate and display in yearly income field.

IF( Monthly_Income__c > 500, Monthly_Income__c * 12, null)

For Example2:-
We can create a formula field form pick list value.
If "Completed_Topics__c" has to be "developer account" Or "Objects" and "Topic_To_be_Covered__c " has to be "layout" or "process builder" then rating should be hot other wise it should be avarage(AVG).

There are two pick list fields:-
1)Completed Topics
2)Topic To be Covered

"Completed Topics" options value
Developer Account
Applications
Objects
Tab

"Topic To be Covered" Option Values:-
Layout
Dependency
Workflow
Process Builder
Validation Rule

IF( AND( OR( ISPICKVAL( Completed_Topics__c , 'Developer Account'), ISPICKVAL(Completed_Topics__c, 'Objects') ), OR( ISPICKVAL( Topic_To_be_Covered__c , 'Layout'), ISPICKVAL (Topic_To_be_Covered__c, 'Process Builder') ) ),'Hot','AVG' )

For Example3:-
We can create a formula field form Contains using formula field.
If phone number contains 999 then FirstName and LastName should be display as a Full Name.

IF( CONTAINS( Phone_Number__c , '999'), First_Name__c + ' ' + Last_Name__c , ' ' )

For Example4:-
We are using Image function from Formula field.
Create a formula field Image, When I create a record then image should be automatic populated through Static Resource.

IMAGE('resource/salesforceBear', 'salesforceBear', 100,150)

For Example5:-
We are using formula field for Remaining Topics through formula function.
If FirstName and LastName does not have blanks then "Covered_Topics__c" should be Minus from "Total_Topics__c" and display in to "Remaining_Topics__c".

IF( AND( NOT( ISBLANK( First_Name__c )), NOT( ISBLANK( Last_Name__c ))), Total_Topics__c - Covered_Topics__c, null )



To know more live demo source code in Salesforce lightning, Trigger, Visualforce & LWC, Use this link..



What is a Formula Field in salesforce? What is a Formula Field in salesforce? Reviewed by Admin on 1:59 AM Rating: 5

5 comments:

header banner -- www.w3web.net



Powered by Blogger.