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
Dale WorthingtonDale Worthington 

Javascript alert based on piclist

Hi All

Im trying to alert based on a picklist, my example is below. 
My understanding is that this should work... Is there something im missing?
 
<apex:page StandardController="Opportunity">

    <script>
    
        if({!Opportunity.StageName}=="Contract Signed")
        
            alert('Alert Box');
            
    </script>

</apex:page>

 
Dale WorthingtonDale Worthington
To note; this page is then inserted into the opportunity record :)
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,

You need to update the script  use '{! }' 
 
<apex:page StandardController="Opportunity">

    <script>
    
        if('{!Opportunity.StageName}'== 'Contract Signed')
        
            alert('Alert Box');
            
    </script>

</apex:page>


Hope this helps !!
--
Thanks,
Swayam