You need to sign in to do that
Don't have an account?

Remove Save & New button of the standard edit page.
Is there anyway to remove/hide the standard Save & New button on the edit page of Salesforce.
I don't want this action for my User and I don't have control over the standard edit page layout of Salesforce unlike the detail page layout. Please let me now if this is possible in some ways in the standard Salesforce page itself.
Regards,
Karthik.
Well, you can hide the 'Save & New' buttons using a script (ex: s-control).
In the script, get the id if the button and On page load event, set the display of that button as 'none'. The S-control should be placed in the sidebar as homepage component. With this, you can even control whether you want to hide 'Save & New' on one particular page or on all pages.
This solves your problem..
All Answers
This really helps.
On Profiles that i do not want to give new buttons, i edit the profile and uncheck the respective buttons.
Thanks.
Sunil.
Just realized ... i can't do this on Standard Profiles. This is limited only to Custom Profiles.
Hmm ... interesting.
So for standard profiles i need to override the new button to a VF page and say ... "Dude, you dont have permissions ... "
Well, you can hide the 'Save & New' buttons using a script (ex: s-control).
In the script, get the id if the button and On page load event, set the display of that button as 'none'. The S-control should be placed in the sidebar as homepage component. With this, you can even control whether you want to hide 'Save & New' on one particular page or on all pages.
This solves your problem..
Hi All,
I was able to hide the Save&New button by using Javascript (on load, set display of that button as None) in Home page component. But , the problem is , due to it, the Helptext (popup near fields to show help text specific to that field) are diabled i.e. when the mouse hovers it, no popup text is being shown. Does anyone have any idea about how to overcome this problem?
Thanks
Thanks for replying!
Yes, I am using the Javascript in a home page component of type HTML area and I am calling the javascript fucntion to hide std button on window.onload event.
How can I use the same javascript in a file or s-control to have it run across all forms?
regards
dcoder
use iframes
ex: <iframe id="sControlTarget" name="sControlTarget" src="/servlet/servlet.Integration?lid=[id of s-control]&ic=1" scrolling="no" frameborder="0" height="0" width="100%"></iframe>
Ady, Thanks a lot for your input!! It is working now. :)
But, we have to use s-control for it. I am bit apprehensive in using s-controls as it is going to be obsolete. I tried doing it using VF page, but VF page is not able to access/set display of std button. Is it the case that we can't do it using Visualforce page instead of s-control?
regards
dcoder
Hi Ady,
Also, could you plz let me know that what is significance of 'lid=[s-control id]&ic=1' .
thanks
dcoder
Its true that S-controls are obsolete, but we can use .js files instead of S-Controls. So no worries.
Happy coding.. ;)
We were actually dealing with the same issue of page errors when the js was in a home page component and not wanting to go the route of an s-control. What ended up working for us was to execute the function after all other window.onload functions completed. The final code we included with some text in a home page component and the website where we found the example are listed below.
<B>Test text for new js</B>
<SCRIPT type=text/javascript>
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(function() {
if(window.parent.document.getElementsByName("save_new" )[0]) {
window.parent.document.getElementsByName("save_new" )[0].style.display='none';
window.parent.document.getElementsByName("save_new" )[1].style.display='none';
}
})
</SCRIPT>
http://simonwillison.net/2004/May/26/addLoadEvent/
Hi,
Even I want to remove Save & New button on Opportunity Edit page. But how to get to the Home page component to include the javascript code?
Thanks
Shiva
Hi Ady I have a requirement to just remove New button from contact page. can you please let me know where and how do I add the js onload function.
Thanks in advance
RS
Hi Shiva,
It will the same code but you need to check the opportunity key code (006) in the URL and then proceed. Homepage component will be available for all the pages, so there will not be any issue. The code will the same as written in the previous messages in this thread.
Ady
Dear sfdeveloper9,
In this scenario is not required to have a homepage component. The other way is to override the Contact tab, with you custom page which will point to the list views. Depending on the scenario, code or approach can be chosen. Still if you want to use the Homepage component, as in the above messages, just use the New button id instead of Save & New button id. New button's name will be rendered as 'New' in the HTML.
Regards,
Ady
Hi Ady,
I have a different scenario for my requirement. I want to remove/hide "Save and Send Update" button on Event detail page. Unfortunately, I cannot override it as it is not listed in Standard buttons sections of Event Object.
Could you let me know how could I hide this button?
Also if I am not able to hide, any message we can throw using javascript or something which will not allow user to use that functionality of the button?
Thanks,
Vimal
Hi Vimal,
For your scenario, you have to get the element using its name "sendEmail" and then hide it..
Happy Coding.. :)
Ady
Thanks a lot Ady. With yours and some help and research on Net, I am able to achieve my functionality!
But it was welcomed by some negative impacts :((
My views on Accounts and Contacts objects are not working. They get stuck with "Loading" status message. And when I dont utilise my javascript file and disable home page component from Home Page Layout, the views load quickly and properly.
Could you tell me what is it that is affecting this?
This is my code:-
window.onload = new function()
{
window.setTimeout(hideBtns,1000);
}
function hideBtns()
{
if(document.getElementsByName("sendEmail")[0]!=null)
document.getElementsByName("sendEmail")[0].style.display = 'none';
if(document.getElementsByName("sendEmail")[1]!=null)
document.getElementsByName("sendEmail")[1].style.display = 'none';
}
Thanks,
Vimal
Can any one assist me with this?
Thanks,
Vimal
Hi Vimal,
The reason you get this problem is when the default functions of salesforce doesnt fire or are overridden. In your code, we can change it as:
window.onload = hideBtns;
function hideBtns()
{
this.bodyOnLoad(); // this line gets back views and other standard functionalities
<your code here>
}
Ady ;)
I found a workaround for this issue that works in my case.
I have a custom object named Client_Case_Notes that is related to the Account object. Other than the name field, it only has 4 other fields: Account (Master-Detail Lookup), New_Case_Note (Long Text Area(32000)), Case_Note_History ((Long Text Area(32000)), and Case_History_Size. Users can only enter information in the New_Case_Note field. I have a couple of workflow rules that fire when the case note is entered. One adds the New_Case_Note to the top of the Case_Note_History field (along with date and user information) and then clears the New_Case_Note field for the next entry. The other one calculates and updates the Case_History_Size field.
I also have a Rollup Summary field on the Account record which counts the number of Case_Note Records related to the account. We only want one.
Then I use the following validation rule on the Case_Note record
AND(Account__r.Number_of_CaseNotes__c > 0, ISNULL( Case_History_Size__c ) )
If there already is a Case_Note record for this Account, and the Case_Note_History has never been updated, then this must be a new record on an Account which already has one. This way the first record can be added (Account__r.Number_of_CaseNotes__c = 0) and existing records (Case_History_Size__c >0) can be saved, but new records cannot be added if one already exists.
@Ady - this.bodyOnLoad(); worked.
Thanks!
Could you please send me a code sample, so that i can have a look. I have got a similar requirment on the same grounds so need your help.
Can you please send me what you did to hide the Save and New Button.
Chirag can you help me out with hiding Save and New Button i am not able to do so. I have followed your blog of sendEmial one for my case but i am not able to achieve it :(
Can you please provide more details on what code you are using to hide or what error are you seeing.
thanks
chirag
I am trying to remove the 'Save & Send Update' button from Event. I don’t know Java or HTML, but I think I’ve been following these instructions exactly:
STEP1: JAVASCRIPT Code. Create a JS file with below code
window.onload = new function()
{
window.setTimeout(hideBtns,2000);
}
function hideBtns()
{
if(document.getElementsByName(“sendEmail”)[0]!=null)
document.getElementsByName(“sendEmail”)[0].style.display = ‘none’;
if(document.getElementsByName(“sendEmail”)[1]!=null)
document.getElementsByName(“sendEmail”)[1].style.display = ‘none’;
}
STEP2: Upload the JS file as a DOCUMENT
STEP3: Create a Home Page Component of type (HTML Area)
<script src=”/servlet/servlet.FileDownload?file=doc id url”></script>
STEP4: Add above created Home page component in your home page layout.
But the button still appears. Step 1: When I save the .js file from Notepad which encoding should be used? Does it matter? Step 3: I paste in with Show HTML checked and save. When I go back to edit, it has disappeared. What else could I be doing wrong?
We got this to work by changing the HTML in STEP 3 to:
<script src="015V00000008w9M" type="text/javascript"></script>
We also added this.bodyOnLoad(); to the js:
window.onload = new function()
{
window.setTimeout(hideBtns,1000);
}
function hideBtns(){
this.bodyOnLoad();
if(document.getElementsByName('sendEmail')[0]!=null)
document.getElementsByName('sendEmail')[0].style.display = 'none';
if(document.getElementsByName('sendEmail')[1]!=null)
document.getElementsByName('sendEmail')[1].style.display = 'none';
}
Now our issue is that when we try to edit or delete the Home Page Component, the system hangs. Any suggestions?
Hi LJenn,
Please clarify: Is the system hanging or just the browser?
If its a browser that hangs, then my guess is you are using IE. Please use firefox / chrome to edit. Or you can use eclipse.
If system is hanging, please share details. It would be interesting. LOL
Ady
Thanks Ady, it was the browser.
Now I have a new, related problem. When I delete a multi-person event, it automatically sends meeting cancellation emails to all invitees. Any ideas on how to prevent this?
Hi,
Can you please help out for removing the standard new button from salesforce account object. Where can i place the java script code. Could you please post the java script code if possible. Thanks in advance.
Thanks,
Lakshmi
hi LJenn / Lakshmi,
Sorry for not replying all these days.
@LJenn: I have no idea. Need to dig into it. Hope you might have solved it by now.
@Lakshmi: New button doesnt have an 'id'. You can pull it using the getElementsByName attribute.
var AccNew = window.parent.document.getElementsByName('new');
for(i=0;i<AccNew.length;i++)
AccNew[i].style.display='none';
or in one line
window.parent.document.getElementsByName("new" )[0].style.display='none';
or you can set the className as 'hidden' if you dont want to use the style.display='none'
Can I have the exact steps and code to remove the Save & new button from edit layouts Thanks in advance!
Can you help me in understanding the steps remove the Save & new button from edit layout of oppurtunity as I have been stuck from long time. I have seen the code above but did not get how to proceed to make it work.Thanks in advance!