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.

    5 comments:

    Anonymous said...

    Awesome, just used this also on a custom object with multiple criteria. Works like a charm.

    Anonymous said...

    How do remove "The page at.....says?

    Unknown said...

    I don't know about it. May be person with good HTML knowledge can answer that.

    Murtaza said...

    awesome trick. already implemented in my project

    Unknown said...

    Did you ever figure out how to remove that phrase?