Button Clutter


Salesforce Buttons are incredibly powerful tools to make it easy and simple to get something with…well the touch of a button!  Now, out of the box, Salesforce only allows us to place custom buttons at the top of the Page Layout, without any sort of organization. This can create a mess like the image above. Here we will go through some basics of the power of custom buttons and also show how to display them on layouts just like any other field.   For this example, we will add a button to the layout that will view a report for that record.

keep-calm-and-keep-it-simple-27


 

1. First, we will create a basic Account report

step 1


 

2. We add a filter for Account ID=(leave it blank), and click OK

step 2


 

3. Save the report in a public folder step 3


 

4. After saving, go back to the report.  Copy the Report Id in the URL. We will need this later on

step 4


5. We need to upload this image as a static resource  step 5    (Right click on the image to the left and click Save Image As)

a. Setup>Develop>Static Resources>New

b. The static resource should look like this

step 5b

c. Click “View file”. Copy the highlighted text in the URL. We will need this later on.

d. In my example: “/resource/1408368127000/ViewReportButton”


6. Now, we can create a formula field on Account that will use this static resource as a hyperlink image. We will then add it to the layout. Setup>Customize>Accounts>Buttons, Links, and Actions

a. The Field should be Type: Formula and the Formula Return Type: Text

b. The Formula itself should contain the following

HYPERLINK(“REPORT ID?pv0=”+ Id, IMAGE(“Image Location”, “View Report”), “_self”)

**In place of REPORT ID, use the copied Report ID from Step 4** **In place of Image Location, use the copied Image Location from Step 5c**

For My Example: HYPERLINK( “00O20000006r9Kn?pv0=”+ Id, IMAGE(“/resource/1408368127000/ViewReportButton”, “View Report”), “_self”)

formula

Step 7


7. WALLA! That’s a wrap. You have successfully added a button to the layout. Now you can can get to work on your next button!

success-baby