web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Remove 'Add Existing xxxxx to this record' button

(0) ShareShare
ReportReport
Posted on by 140

Hi,

I am working on removing the 'Add Existing XXXX to this record' button using javascript. I am trying to use the code provided by Dave Hawes in his blog: http://blog.davehawes.com/post/2008/04/23/MSCRM-4-Remove-Add-Existing-xxxxx-button.aspx 

The code provided by Dave doesnt work in my case because the related entity is in an Iframe on the 2nd tab in the Information pane. I have changed the code to work on the tab.onclick event instead of on the navElement.onclick, but it doesn't server the purpose for me. Any advice on how to proceed with this issue is greatly appreciated. Thanks in advance.

Regards,

Raj 

 

 

 

*This post is locked for comments

I have the same question (0)
  • Kiran Kumar CVV Profile Picture
    20 on at
    Try this snippet. // Hiding new and existing buttons HideAssociatedViewButtons('relationship schema name', ['Add existing entity 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; } } } } } } } Regards, Kiran
  • Raj Chatrathy Profile Picture
    140 on at

    Kiran,

    Thank you for your reply. There was a lot of code in the onload event for that entity provided by our CRM vendor. I figured out the location of code where the iFrame was getting loaded and hid the button from there and it worked.

     I would still like to try your code early next week. Thanks again for your reply.

     

    Regards,

    Raj.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans