Monday, 28 March 2011

Creating a Web-to-Lead Form (Part 1)

For those who follow my blog you might remember that I previously mentioned that I have been tinkering with force.com sites. Someone recently asked me to how to create Web-to-lead forms so I thought it would be great idea to go over this process in the next few posts. Implementing these forms on your force.com site will allow a company to capture a prospective customers information. In order to do this we need to create a custom contact page. This will show up when prospective customers  submit their information.

Ultimately we will have to create two Visualforce pages...in these post we will go over the 1st one which is need to display the confirmation. First you need to click 'Setup', then 'Develop', and finally 'Pages'. For the Label I suggest entering 'Thank You Page' and for the Name I suggest entering 'ThankYou'....that being said you can enter whatever you feel is appropriate. The last step is to replace the existing the Visualforce markup with the following (again you can change the title and message to what you feel is appropriate):

01        <apex:page title="Information Request" 
02                              showHeader="false" standardStylesheets="true">
03       <apex:composition template="{!$Site.Template}">
04         <apex:define name="body">
05             <br/>
06             <center>
07             <apex:outputText value="Thank You For Your Inquiry!"/>
08             </center>
09             <br/>
10             <br/>
11         </apex:define>
12       </apex:composition>
13    </apex:page>

After this is done you have to extend the standard controller in place to redirect the would be users to a custom contact page when they submit information. We have to do this because as a default Salesforce.com makes it so the standard controller directs the user to the standard detail page after saving the related record. However these standard detail pages can not be made public on via regular sites.

In the next post we will go over how to direct the users to a custom Visualforce page by creating an extension for the standard controller. Please try to control your anticipation until then...        

No comments:

Post a Comment