Insert comma in formula field
Use & ", " & to concatenating two or more text fields
Example: If you want to concatenate Last name and First name by comma then follow below steps
- Go to Setup -> Customize -> Select Contact Object -> Fields
- Create new formula field with label Full Name and select "Text" as a Formula Return Type and use below formula
- LastName & ", " & FirstName
Some other formula examples with code:
1. Case Aging (all cases) : Calculates the number of days a case has been open, for both open and closed cases.
Formula :
IF( {!IsClosed} , ROUND({!ClosedDate} -
{!CreatedDate}, 0) , ROUND((NOW() -
{!CreatedDate}),0))
2. Case Aging (for open cases) :
You have a use case like, Calculates the how many numbers of days a case has been open. If the case is closed, then sets the result to blank. And add this formula to a related list as the ascending sort column. With the help of this, you can quickly see which currently open cases have been open the longest.
Formula :
IF( {!IsClosed},null, NOW() - {!CreatedDate} )
9. Timesheet (hours worked per week) :
This uses a custom tab which enables time tracking of hours worked per
day. Use below a formula and add it in formula field to add up the hours per week.
Formula :
{!MonHours__c} + {!TuesHours__c} + {!WedsHours__c}
+ {!ThursHours__c} + {!FriHours__c}
10. Web Site Link :
This creates a link namely 'Company’s Offer Website' that redirects a
user to the Web site address on any record.
Formula :
HYPERLINK({!Website}, "Company’s Offer Website")
Note: Salesforce block JavaScript execution in hyperlink formula fields
Have I missed anything? Please comment below and I will add that to this list.
Enjoy! If you have any questions, comments, please feel free to let me know.
As always, please feel free to get in touch me as I would be more than happy to assist you with any of your Salesforce development needs.
1. Case Aging (all cases) : Calculates the number of days a case has been open, for both open and closed cases.
Formula :
IF( {!IsClosed} , ROUND({!ClosedDate} -
{!CreatedDate}, 0) , ROUND((NOW() -
{!CreatedDate}),0))
2. Case Aging (for open cases) :
You have a use case like, Calculates the how many numbers of days a case has been open. If the case is closed, then sets the result to blank. And add this formula to a related list as the ascending sort column. With the help of this, you can quickly see which currently open cases have been open the longest.
Formula :
IF( {!IsClosed},null, NOW() - {!CreatedDate} )
3. Flags for Case Priority : Based on Case priority, set flag so user can easily check which case is on priority.
Formula :
IMAGE(
CASE( Priority,
"Low", "/img/samples/flag_green.gif",
"Medium", "/img/samples/flag_yellow.gif",
"High", "/img/samples/flag_red.gif",
"/s.gif"),
"Priority Flag")
4. Stars for Ratings : This formula displays a set of one to five stars to indicate a rating or score.
Formula :
IMAGE(
CASE(Rating__c,
"1", "/img/samples/stars_100.gif",
"2", "/img/samples/stars_200.gif",
"3", "/img/samples/stars_300.gif",
"4", "/img/samples/stars_400.gif",
"5", "/img/samples/stars_500.gif",
"/img/samples/stars_000.gif"),
"rating")
5. Expected Product Revenue : This formula calculates total revenue from multiple products, each with a different probability of closing.
Formula :
ProductA_probability__c * ProductA_revenue__c + ProductB_probability__c * ProductB_revenue__c
6. Opportunity Total Deal Size : This formula calculates the sum of maintenance and services amounts.
Formula :
Amount + Maint_Amount__c + Services_Amount__c
7. Total Amount : This formula calculates a total amount based on unit pricing and total units.
Formula :
Unit_price__c * Total_units__c
8. Opportunity Discount with Approval :
This formula adds an “Is Discount Approved ?” checkbox to an opportunity.
It checks the value of the approval flag and uses conditional logic to check before calculating the commission.
Formula :
IF(Is_Discount_Approved__c, ROUND(Amount – Amount * Discount_Percent__c, 2), Amount)
This uses a custom tab which enables time tracking of hours worked per
day. Use below a formula and add it in formula field to add up the hours per week.
Formula :
{!MonHours__c} + {!TuesHours__c} + {!WedsHours__c}
+ {!ThursHours__c} + {!FriHours__c}
10. Web Site Link :
This creates a link namely 'Company’s Offer Website' that redirects a
user to the Web site address on any record.
Formula :
HYPERLINK({!Website}, "Company’s Offer Website")
Note: Salesforce block JavaScript execution in hyperlink formula fields
Have I missed anything? Please comment below and I will add that to this list.
Enjoy! If you have any questions, comments, please feel free to let me know.
As always, please feel free to get in touch me as I would be more than happy to assist you with any of your Salesforce development needs.
Next Post : Simple Guidance For You In Access Of Subquery Field Value Using Apex - Upwards Traversal.
No comments:
Post a Comment