0

Hi I am using below code to display alert.

alert('hiii.'); window.open('redirecting to new opportunity page');

However when the alert is diplayed and page is redirected i get attached error.​

enter image description here

7
  • Windows.Open gives pop-up in IE to allow site to be added to trusted. I dont want users to do this Aug 29 '17 at 7:23
  • Could you add some more details? Basically when you want to show alert and where it should redirect. Aug 29 '17 at 7:23
  • I want to show the alert on standard button by replacing it with VF page rather than the standard. Once the alert is displayed and user clicks OK is I want the page to be redirected to the standard page. eg: Opportunity page has new button, will replace the standard page with this VF page which will show an alert and on clicking OK redirects to new opportunity creation page. Aug 29 '17 at 7:25
  • If I understand correctly then you will create custom button whose behaviour will be Execute JavaScript and then on validation if its true then redirect to new VF page else on new standard opportunity page. Please verify. Aug 29 '17 at 7:37
  • No, i will redirect button to the VF page created in which i have written above code which will display alert and then will redirect user to page which has fields to create new opportunity page. Aug 29 '17 at 7:41
0

You can use a Controller to redirect. Create an action returning page reference to your page

public PageReference someMethod()
{
PageReference page;
page = new PageReference('your-page-name');
return page;
} 
1
  • can we accomplish without using class I am using: apex:page standardController="Project__c"> <script language="javascript"> alert('Hii.'); window.location.href = 'page link'; </script> </apex:page> Aug 29 '17 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.