Some time user is not required some buttons to be shown in associated view grid menu.
To hide associated view buttons we are required to Add JavaScript on the form OnLoad event of entity, in which this assicated view is shown.
Suppose we want to hide "Add existing ----" button from associated view.
This assoicated view will be shown in Account entity, and associated view is of some custom entity. then we are requried to add following JavaScript on Account form load event.
====================================
==================================== HideAssociatedViewButtons function requires loadAreaId, buttonTitles as a parameters. We can find this loadAreaID, by viewing source code of Account form. and buttonTitles means ToolTip of that button. Above all contents are referred from http://blog.davehawes.com/post/2008/04/24/MSCRM-4-Remove-Add-Existing-xxxxx-button.aspx
To hide associated view buttons we are required to Add JavaScript on the form OnLoad event of entity, in which this assicated view is shown.
Suppose we want to hide "Add existing ----" button from associated view.
This assoicated view will be shown in Account entity, and associated view is of some custom entity. then we are requried to add following JavaScript on Account form load event.
====================================
HideAssociatedViewButtons('new_account_new_sponsoredkid', ['Add existing Sponsored Kid
to this record']);
function HideAssociatedViewButtons(loadAreaId, buttonTitles){
var navElement = document.getElementById('nav_' + loadAreaId);
if (navElement != null) {
navElement.onclick = function LoadAreaOverride()
{
// Call
the original CRM method to launch the navigation link and create area iFrame
loadArea(loadAreaId);
HideViewButtons(document.getElementById(loadAreaId + 'Frame'), buttonTitles);
}
}
}
function HideViewButtons(Iframe, buttonTitles) {
if (Iframe != null) {
Iframe.onreadystatechange = function HideTitledButtons()
{
if (Iframe.readyState == 'complete') {
var iFrame = frames[window.event.srcElement.id]; var liElements =
iFrame.document.getElementsByTagName('li');
for (var j = 0; j < buttonTitles.length; j++) {
for (var i = 0; i <
liElements.length; i++) {
if (liElements[i].getAttribute('title') ==
buttonTitles[j]) {
liElements[i].style.display = 'none'; break;
}
}
}
}
}
}
}==================================== HideAssociatedViewButtons function requires loadAreaId, buttonTitles as a parameters. We can find this loadAreaID, by viewing source code of Account form. and buttonTitles means ToolTip of that button. Above all contents are referred from http://blog.davehawes.com/post/2008/04/24/MSCRM-4-Remove-Add-Existing-xxxxx-button.aspx
This comment has been removed by a blog administrator.
ReplyDeleteHi There,
ReplyDeletei have tried the above listed two functions into the onload event of one entity. but i don't know why it did not work at all.
during the testing what i had found is it did not even go into the code right after the following line
var navElement = document.getElementById('nav_' + loadAreaId);
then i had added the following few lines to check wheather it works or not
if (navElement == null)
{
navElement = document.getElementById('nav' + loadAreaId);
isNativeEntity = true;
}
if (navElement != null)
{
}
could any one help me out to resolve this issue.
it would highly appreciated
thanks in advance
Thanks,
ReplyDeleteIt helps me
this work only for parental relationship???
ReplyDeleteThanks man! It worked great.
ReplyDeletecould anyone provide the above code but where it is hiding the export to excel button?
ReplyDeletemany many thanks
Everything we see hides another thing, we always want to see what is hidden by what we see. See the link below for more info.
ReplyDelete#hides
www.ufgop.org