function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

simple alert popup on opportunity

I want a pop-up with an informational message when a user closes an opportunity to make it an account.  So, I can create an s-control that has an alert().


<html> <head> <script> var result = "{!Opportunity.StageName}"; function init() { if (result == "Closed") { alert("My message goes here."); } } </script> </head> <body onload="init()"> </body> </html>


Can I use the merge field syntax to obtain the stage name of the opportunity being edited as I'm using above in the s-control?


In order to call this s-control, I would need to override the edit button on the opportunity in the buttons and links section, is that correct?



Greg HGreg H

You should have no problem using the merge fields in your sControl. However, instead of doing a button override simply add the sControl to the page layout and format the size so that it is not impactful to the user. This will allow you to keep the alert that you require. It will also display the alert every single time the opportunity page is accessed for records that are "Closed," which may become annoying to your Users.