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
mat_tone_84mat_tone_84 

code window.open of popup doesn't work

Hi,

since yesterday the code work properly and I saw the popup of url, but now it doesn't show me any popup

I want open popup with url every time if the stagename of opportunity is closed/won.

I have active the popup on chrome, ie , firefox.

What kind of problem is it ?

thank

 

 

<apex:page standardController="opportunity" >
    
  <script src="/soap/ajax/10.0/connection.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/functions.js"></script>
<script>

if ('{!Opportunity.StageName}' == 'closed/won') {
var url1= 'http://www.mysite.com/'
window.open(url1)
}
</script>

 

 

Anand@SAASAnand@SAAS

Not sure why you need "connection.js" and "function.js" in your page code. 

 

Also, {!Opportunity.StageName} is typically escaped to avoid any XSS,CSRF issues. You might want to try the following code to help trouble shoot the issue:

 

 

<apex:page standardController="opportunity" >
    
<script type="text/javascript">
var oppStage = '{!Opportunity.StageName}';
alert(oppStage);
if ( oppStage == 'closed/won') {
var url1= 'http://www.mysite.com/'
window.open(url1)
}
</script>

 

 

mat_tone_84mat_tone_84

thanks, it works properly, maybe the SF has changed sometimes and my old java didn't work.

 

maybe I get the code from some demo on SF and I don't delete "connection.js" and "function.js".