Wednesday, June 8, 2011

Simple Pop-up alert in Salesforce

Salesforce.com doesn't give any pop up alert windows. An alert window will be useful to get attention of user. A combination of visualforce page and java scripts can be used to give such alerts. Eg. We want to alert Salesforce user to create an order when opportunity is "Closed Won".

Here are the steps.
  • Create a visualforce page on opportunity with following code.

  • Go to opportunity and edit opportunity page layout. Drag this new visualforce page on page layout. Edit the visualforce page properties and set Height as 0 pixel. (We don't need to show this page to users.) Save the page layout.
 

    This code can be enhanced with multiple conditions. Alert of any existing field also can be given.