Adding a Send An Email button on the home page
Within the Salesforce CRM application you can natively add custom links to the home page, which can be configured to call web URLs. These URLs can be either external to Salesforce or internal, such as a link to the Salesforce CRM Training pages (covered in an earlier recipe within this chapter).
Salesforce does not, however, natively provide a way of adding custom buttons onto the home page in order to call web URLs.
Often it is preferable to provide a button to invoke certain behavior (rather than a URL link). One such example is a Send An Email button.
How to do it...
Carry out the following steps to add a Send An Email button to the home page:
- Navigate to the home page components setup page by going to Your Name | Setup | Customize | Home | Home Page Components.
- Click on New.
- Click on Next (on the Understanding Custom Components splash screen if shown). The Next button is found on the Understanding Custom Components splash screen (this page is only shown if the Don't show this page again checkbox has not previously been checked), as shown in the following screenshot:
Here, we will be presented with the Step 1. New Custom Components page.
- Enter the name of the custom component in the Name field. Enter the text
Email Button
. - Select the HTML Area option from the Type options list.
- Click on Next.
- Ensure that the Wide (Right) Column option is selected within the Component Position option list.
- Check the Show HTML checkbox.
- Paste the following code (as shown in the following screenshot):
<INPUT style="BACKGROUND-IMAGE: url(/img/bgButton.gif); BORDER-BOTTOM: #5c5d61 1px solid; PADDING-BOTTOM: 1px; BORDER-LEFT-STYLE: none; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; DISPLAY: inline; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: 'Verdana', 'Geneva', sans-serif; BACKGROUND-POSITION: left top; BORDER-TOP-STYLE: none; COLOR: #ffffff; FONT-SIZE: 80%; CURSOR: pointer; FONT-WEIGHT: bold; BORDER-RIGHT: #5c5d61 1px solid; PADDING-TOP: 1px" title="This will send an email" onclick="javascript:window.location='/_ui/core/email/author/EmailAuthor';" name=SendAnEmail value=Send type=button>
- Click on Save.
- Navigate to the home page components setup page, by clicking the following: Your Name | Setup | Customize | Home | Home Page Layouts.
- Determine which home page layout to place the component on and click Edit. Here we are editing the home page layout named DE Default.
We will be presented with the Step 1. Select the components to show page.
- Check the Send An Email checkbox in the Select Wide Components to Show section as shown:
- Click on Next.
- Position the Send An Email button as the top position in the Wide (Right) Column using the Arrange the component on your home page. section, as shown in the following screenshot:
- Click on Save.
How it works...
You can see what this looks like in the following screenshot:
When the button is clicked the task's e-mail page is displayed, as shown in the following screenshot:
There's more...
When entering HTML and JavaScript code into the HTML editor section (in Step 2 of the New Custom Component wizard) you must ensure that the code is valid.
There are a maximum of 20 custom components that can be added to a home page layout.