Wednesday, June 22, 2011

Helpful Salesforce.com Formulas

I spend many of my days as a Salesforce.com instructor.  During my classes, I tend to create formula examples to solve problems of students in the class.  Some of these formulas come from my mind and some come from the mind of my students.  Here are several formula examples that I used in the ADM-301 Advanced Administration class in Boston the week of 6/13:

Creating an Edit Link:

The idea behind this formula is that you can create a field that is a link to the Edit page of any record.  This is helpful if you want to allow the user to edit records from a report.  Simply include the field in the report and users can click on the link to edit the record rather than having to navigate off the report.

HYPERLINK("/" & Id & "/e", "Edit", "_blank")

The "IsMine" Formula:

This formula is the brain child of Rick Enriquez, a student in one of my classes in Orange County.  It solves the problem of not being able to use the "My" functionality for any record not owned by the user.  Here is the scenario:  We have a custom object called Position__c.  That position is owned by a recruiter, but we also track a Hiring Manager.  We want to be able to create a view or report that allows the Hiring Manager and the Hiring Manager's manager to be able to see all their positions even though they aren't the owner.  This formula accomplishes that.  Simply create a view or report with the filter IsMine equals true and you will get the results you want.

if( Hiring_Manager__r.Id = $User.Id || $User.Id = Hiring_Manager__r.ManagerId ,"true", "false")   

Google Search Formula: 

This formula demonstrates the ability to create a hyperlink formula, pass parameters and display an image all in the same formula.  This formula lives on the Account object and displays a Google button image that when clicked on passes the Account Name into Google to perform a search.  The Google Button image was uploaded to the document library and marked as an externally available image.

HYPERLINK("http://www.google.com/search?q=" & Name, IMAGE("https://c.na1.content.force.com/servlet/servlet.ImageServer?id=01530000001pqpi&oid=00D30000001FO3z&lastMod=1308319907000", "Search Google") , "_blank")




No comments:

Post a Comment