You need to sign in to do that
Don't have an account?
How to override Account Team - Add button?
Hi,
I need to hide/disable/override Add button of Account Team section - so that I can prevent Account Team Member creation from Salesforce UI and make it doable via webservice only, as requested.
I revoked the Account Edit access for non Admin profile users. So that they cannot add Account Team Member to accounts that they are not own.
However, I couldnt stop Account Owners and System Admin users from creating Account Team Member thru UI. So, thinking of overridding the Add button to prevent account team creation.
Can anyone share me the workaround to fix this scenario.
Regards,
SuBaa
Hi,
I fixed this issue, using the below script.
<SCRIPT language=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("add")[0]) {
window.parent.document.getElementsByName("add")[0].style.display='none';
}
if (window.parent.document.getElementsByName("addAccTeam")[0]) {
window.parent.document.getElementsByName("addAccTeam")[0].style.display='none';
}
}
) </SCRIPT>
Thanks.
Regards,
SuBaa
All Answers
You can use a Javascript hack to hide it, as described here:
http://www.salesforcefast.com/2011/03/altering-page-elements-with-javascript.html
What this does is put some JS on the sidebar and when it finds the page element corresponding to the Add button, it hides it.
Hope this helps,
Hi John,
I tried the below logic with given code as basic. But, I am not able to hide 'Add' button in Account Team related section. I was thinking of that the given logic may not applicable for 'Add' button. So, tried to recreate for Save & Send Update button as mentioned in the blog. But, I couldn't resolved it. So, please let me know if any other steps/settings need to be followed beside the given steps.
1) Created a Home page component for Java Script (I tried other approach also: created a Document for JS and referred in HTML Area home page component)
2) Added that home page component into home page layout in the narrow side (Show Custom Sidebar Components on All Pages is selected already)
Tested code:
<SCRIPT language=javascript>
window.onload = new function()
{
alert('before calling');
window.setTimeout(hideBtns,2000);
}
function hideBtns()
{
alert('before');
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’;
}
</SCRIPT>
Regards,
SuBaa
Hi,
I fixed this issue, using the below script.
<SCRIPT language=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("add")[0]) {
window.parent.document.getElementsByName("add")[0].style.display='none';
}
if (window.parent.document.getElementsByName("addAccTeam")[0]) {
window.parent.document.getElementsByName("addAccTeam")[0].style.display='none';
}
}
) </SCRIPT>
Thanks.
Regards,
SuBaa
Can you please let us know that where we need to add this script. i tried by adding this script in Home Page Component narrow side but didnt worked. Can you please help me out..
Thanks!