Duplicate data is always a problem, particularly when the quantity of data is too large and when the quality of data is very critical..

Salesforce uses a 'UNIQUE' definition on a field to avoid duplicates. When this attribute is set to TRUE you will have only unique values in the field.

Problem:Salesforce displays an error message when you try to enter a duplicate value and click on "SAVE". But, you would not want the user to enter all values and get an error message as the last step. Moreover, in some cases you would not want the user to create a new record if it already exists...

Solution:Clearly, a search for existing records before creating a new one would be a typical solution. But not all fields are searchable.....

A more user friendly approach would be to allow the user to enter the UNIQUE field first, if the value already exists he would be shown an error message else he will be redirected to the normal New Page screen...

Having something look standard and uniform really matters.. You would like to present the user with the Standard look and feel wherever possible..

Situations in which this may not be possible are

Email Templates

Web-to-Lead

Etc etc

As you may be knowing, Salesforce uses a bunch of CSS files to present users with the standard salesforce look and feel..

Click here to read the Salesforce documentation. The following three files are the most commonly used.

Note that i have specified "na5.salesforce.com" in the URL, this is to be used when your page would be displayed outside of Salesforce otherwise you may omit this part. This may be any instance, not specifically na5... This file is public so anyone can access it. you do not need a Salesforce username and password to access it..

I have a table to display in my Visualforce email template. I am using a HTML table. Since the apex:detail tag is not available with Visualforce email templates, i will display the information in a HTML table and apply salesforce look and feel o make it appear as a standard Detail Page...

The blue colored part in the code above is the modifications that we have done to our plain HTML table. Now ,let's analyze the code in detail... The Head tag as you know contain links to salesforce style sheets...

<body class="opportunityTab detailPage">

This sets the color of the Page layout to Opportunity since we have specified Opportunitytab in the styleclass.. If you set it o Accounttab the style of Account will be applied....

<div class="bPageBlock secondaryPalette">

This div denotes the pageblock this is the main outer div....

<div class="pbBody">

This div denotes the pageblocksection.

<div class="pbSubsection">

This div denotes the data to be displayed inside the pabeblocksection.

Inside the HTML table we have td class="labelCol", this is used only for headings to make sure that it is bold and is right aligned..