1

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.

4 Answers 4

3

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.

1
  • well, I don't understand how I combine the two. I guess it has nothing to apex, but never added a JS to a SF page. can you please show me how?
    – Saariko
    Aug 16, 2012 at 7:02
2

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

1

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

1

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

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .