Find your content:

Search form

You are here

Can I create a popup/alert window/message when a SF page loads?

 
Share

I would like that depending on some criteria's (checkbox, date, name, value) of a certain field/custom field, on an object. Once that object loads, a popup window will appear. an OK button is sufficiant.

enter image description here

It can be also like the html pop up for tasks overdue alerts.


Attribution to: Saariko

Possible Suggestion/Solution #1

Is there a reason that you can't use a standard javascript alert? Here is a 'complete' VisualForce page using such a popup:

    window.document.onload = new function(e)
    {
      if({!Contact.Some_Checkbox__c})
      {
        alert("Checkbox is True");
      }
      else
      {
        alert("Checkbox is False");
      }
    }
</script>

If the custom checkbox field 'Some Checkbox' on the contact record used in the URL (which would be "http://someinstance/apex/ThePage?id=") the popup will say 'Checkbox is True' and vice versa.


Attribution to: Matt Lacey

Possible Suggestion/Solution #2

I guess you want the popup alert on the detail page. Well, in that case, please create a VF page with standardController set as your object and then paste the above code given by Matt and then with page layout, add this page on the detail page. And then make the width and height as small as you can.

Thanks, SP


Attribution to: Shailesh P

Possible Suggestion/Solution #3

its something we all come across, but I believe you can execute standard Javascript on VFPages, you might want to check out the Previous post on using Jquery in Visual Force or I would highly recommend you to check this documentation

Let us know if this helped you out


Attribution to: Shivanath D

Possible Suggestion/Solution #4

So Laceys full code would be

<apex:page StandardController="Contact">

<script>

window.document.onload = new function(e)
{
  if({!Contact.Some_Checkbox__c})
  {
    alert("Checkbox is True");
  }
  else
  {
    alert("Checkbox is False");
  }
}
</script>

</apex:page>

You need to create this, then add the Visualforce page via your pagelayout on the appropriate object, in this case Contact. As Shailesh said be sure to make this as small as possible (1px) because it serves no other function than to act as a pop-up


Attribution to: Mitch Hunt
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/490

My Block Status

My Block Content