Salesforce just launched Force.com Sites and it's free for all Enterprise and Unlimited Edition subscribers! Here's a great intro to Force.com Sites, including some possibilities for driving value to your organization leveraging it's power:
My favorite application of Sites is creating landing pages that directly update responses in Salesforce campaigns. Some advantages of using Sites for response capture on landing pages:
- Fewer duplicate leads
- Cleaner response data
- Secure, hosted, and scalable
Sites minimizes dupe leads by updating the campaign member record directly instead of creating a duplicate lead that has to be merged back to the original lead or contact. Sites is a clean, hassle-free way to create webforms because any picklist option you add in Salesforce is immediately available on the web form. This means if you add an option to a "Product Interest" custom field on campaign member in Salesforce, this product can immediately appear on the Sites pages your prospects and customers see, minimizing maintenance and creating a simple way to keep data clean. Finally, Sites is battle tested against security threats and huge traffic spikes so you can rest easy your customers will have a consistent experience.
Now we'll get into the meat: how to leverage Sites for event registration pages and set up your first page. Using examples from the last post, you can set up workflow rules to email anyone added to a campaign. By the end of this post, you'll know how to include smart links in those emails to drive prospects to your campaign member Sites Event pages, and automatically update responses from those pages such as this example:
http://jdk470.force.com/?id=00v3000000JIrl6AAD
To get there, we'll explore the 3 key pieces to your first site page:
1) Set up your email links to include campaign member Id's in the URL
2) Set up Force.com Sites security permissions to allow access to relevant campaign members
3) Set up your Visualforce page to tie to campaign members
Read More >
1) Setting up email links to include campaign member Id's in the URL
The secret sauce to a Sites page is a variable in the URL that communicates which campaign member to update. You can either sign up for a free URL such as <yourcompanyname>.force.com or route Sites to your branded URL such as www.<yourcompanyname>.com. To pass the ID to Sites, the URL needs to look something like this:
http://acme.force.com/?id=00v3000000JIrl6AAD
or this:
http://www.acme.com/LandingPageName?id=00v3000000JIrl6AAD
In the last post, we saw how you can send emails to campaign members. Using campaign member email templates, it's easy to send an email to both leads and contacts and include their campaign member ID in the URL.
First, select your campaign member email template by clicking Setup-->Communication Templates-->Email Templates.
Click "Edit HTML Version" or "Edit Text Version," depending on which type you created.
Next, under "Available Merge Fields", select "Campaign Member Fields" and "Campaign ID", and copy the merge field value for campaign member ID:
{!CampaignMember.CampaignId}
Highlight the area where you want to make the link, and then click on the icon next to U to insert a link.
Finally, enter the URL of the link to your landing page, making sure to include the Id variable at the end of the URL:
?id={!CampaignMember.CampaignId}
Now whenver the email is sent out, the Campaign Member Id will be included in the link, ensuring the right record is updated on the Sites page.
2) Setting up Sites Security Permissions
By default, Force.com Sites doesn't allow public access to any of your company's data, as you'd expect. Therefore, in for the page to know who the campaign member is, we need to open up access to the campaign member table.
First, go to your Sites setup by clicking Setup-->Develop-->Sites, then click the Site Label to get to your site details.
Click on Public Access Settings, then click Edit to view the profile assigned to the Guest User License
The Guest User license is the license that is used for public access to Sites so changes to this profile will change access levels for the public. Scroll down to the Standard Objects Permissions, and grant "Read" access to Campaigns, Contacts, and Leads. Don't worry - this doesn't mean any hacker can now steal your leads and contacts, it only means that if a Visualforce page (our landing page) is configured properly, the Id variable can be used to display campaign member information that you chose to make public.
Now any Visualforce page that uses campaign member as the controlling object can read and write information to campaign member records if the correct Id is created.
To take the security the next level, you could pass an encrypted key in the email link's URL instead of campaign member Id or enable Captcha to prevent bot responses. To use the encrypted key instead of campaign member Id, you'd need to pass that key in the email link's URL instead of the Id, have your campaign member Apex controller find the Id from the key, and load that record into the page. I'll write a more detailed post on how this might work in the near future. These articles talk to each of those options:
How to create encrypted keys using a trigger:
http://blog.sforce.com/sforce/2009/04/best-practices-sites-and-record-identifiers.html
How to embed Captcha spam prevention on Sites:
http://wiki.developerforce.com/index.php/Adding_CAPTCHA_to_Force.com_Sites
3) Setting up a Campaign Member Visualforce Page to be used for Sites
The last step is to create a campaign member Visualforce page. Most of the stuff here is pretty geeky so you'll want to rope in your web developer if you don't have Visualforce pages already.
At the most basic level, you need 3 things for this to work:
1) An Apex controller extension for campaign member to update the campaign member when your prospect clicks "submit"
2) A Visualforce page
3) That Visualforce page exposed on Sites
To give you a head start on the Apex controller extension and the Visualforce page, here are two different code examples, one simple, and one complex:
Simple Visualforce page:
http://community.salesforce.com/sforce/board/message?board.id=practices&message.id=6256
Visualforce page using tables for formatting & publicly cached static resources for pictures:
http://community.salesforce.com/sforce/board/message?message.uid=131544
In both of these examples, I've exposed fields such as Id and Status to show how they can be updated. In practice, you'll probably want to hide these and assign a specific status value such as "RSVP-Yes" to ensure there are no errors. In the second example, note you'll have to delete the four static resource references to run it without further customizations.
Finally, to expose the page on Sites, first go to your site by clicking Setup-->Develop-->Sites, and then click "Edit" for the site you want to add this page to. In the Site Edit page, under "Active Site Home Page", select the VisualForce page you'd like to be public. Pictured below I've added my Visualforce page called "Web2CampaignMember":
Now you should be good to go! Test it out and you'll see there are many options for using these sites pages including easy event registration forms, passing hidden fields, and showing dynamic content based on who that person is or what they have done.