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
Gattam Rakesh (SFDC)Gattam Rakesh (SFDC) 

How to override a standard Button with a popup message

Hello all ,
Can any one tell me how to override a standard button with popup message
for example if the user click on new button in Account Page he need to get a popup message "Sorry you account create a new Account"
 
CLKCLK
There is option to override button with javascript Where you can put in your validation.
If user passes all the criterias then you can redirect User to new Account creation Std. page using script- Window.location = '\001\e' ;
Dushyant SonwarDushyant Sonwar
Hey Gattam,
Create A Custom Vf page with this script
<script>
alert('Sorry you account create a new Account');
window.location.href='/001/o';
</script>
and overide new button with this..
 
Dushyant SonwarDushyant Sonwar
Hey Gattam,
When you a Create your Custom page set standardcontroller="Account" as if you will not set it then your page will not be shown in Visulaforce Page Picklist in overide option.
Gattam Rakesh (SFDC)Gattam Rakesh (SFDC)
But Iam not Over Riding New Button With Visual Force Page @Dushyant Sonwar
Dushyant SonwarDushyant Sonwar
Then Which Approach you are using to override standard new button @Gattam?
Gattam Rakesh (SFDC)Gattam Rakesh (SFDC)
Actually my Requirment is User should create order from Account Page he should not create Order from Order tab so I have Create a button in Account Page to create a Order but now he should not Create  in Order Tab so i need to Overide the new Button with this message "Sorry You Cannot Create Order Here"
Dushyant SonwarDushyant Sonwar
Hey Gattam,
You can also hide your Order Tab for particular profile in Profile Detail page.you can  acheive your output with this. Why do you want to override your standard new button?
 
Beer NutthawanBeer Nutthawan
Hi Gattam, 

You need to create a visualforce page by copying this code, then override your "New" button in object Order with this Visualforce page. 
 
<apex:page standardController="Order__c">
  <script language="javascript">
       alert('Sorry You Cannot Create Order Here');
       window.location.assign("/001/o");
  </script>
  
</apex:page>

 
Gattam Rakesh (SFDC)Gattam Rakesh (SFDC)
Hai Nutthawan
 It Works But my Requirment is it shouldnot redirect to V.F Page Just A popup message Should Come in the same Page once we  click on New Button
Dushyant SonwarDushyant Sonwar
Hey Gattam,
I dont't think there is any Option to override your standard new button with javascript.
Beer NutthawanBeer Nutthawan
Hey Gattam 

Dushyant is right!! , you can see here: 
User-added image

If you are expecting to create a "New" custom button with javascript code then where can we assign your "New" button to "New" standard button? since its only for Visualforce page here, Btw custom button can be added in Page Layout and Visualforce page