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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

how to hide "Open in New Window" button from all CRM Forms ?

(2) ShareShare
ReportReport
Posted on by 5
In Microsoft Dynamics 365 (CRM), there is "Open in New Window" button, some how can we hide it from all the form ?
this button is not visible in ribbon workbench.
 
I have the same question (0)
  • Suggested answer
    Daivat Vartak (v-9davar) Profile Picture
    7,827 Super User 2025 Season 2 on at
    how to hide "Open in New Window" button from all CRM Forms ?
    Hello CU30041349-0,
     

    You're right, the "Open in new window" button that appears in the command bar of Dynamics 365 Unified Interface forms is a standard, client-side browser functionality triggered by the platform. It's not a traditional ribbon button that you can directly manipulate using the Ribbon Workbench.

    However, you can hide this button using Client-Side JavaScript that runs when the form loads. Here's how you can achieve this:

    Method: Using JavaScript to Hide the "Open in New Window" Button

    The strategy involves targeting the specific HTML element that constitutes this button and setting its display style to none.

    Steps:

    1. Create a JavaScript Web Resource:

      • Go to Settings > Customization > Customize the System.

      • In the Solution Explorer, navigate to Web Resources.

      • Click New.

      • Enter a Name (e.g., HideOpenInNewWindowButton.js).

      • Set the Type to Script (JScript).

      • Click Text Editor and paste the following JavaScript code:

      • function hideOpenInNewWindow() {

          setTimeout(function() {
              var openInNewWindowButton = document.querySelector("button[aria-label='Open in new window']");
              if (openInNewWindowButton) {
                  openInNewWindowButton.style.display = 'none';
              }
          }, 100); // Adjust the timeout if needed
      • }

      •  
       
      • Click Save and then Publish the web resource.

      •  

    2. Add the Web Resource to All Forms:
       
      • In the Solution Explorer, expand Entities.

      • For each entity where you want to hide this button:

        • Expand the entity and click on Forms.

        • Open each Main form for that entity.

        • In the Form editor, go to the Insert tab and click Web Resource.

        • In the "Add Web Resource" dialog:

          • Look up and select the web resource you just created (HideOpenInNewWindowButton.js).

          • Enter a Name for the web resource on the form (e.g., HideOpenInNewWindowScript).

          • Uncheck the "Display border" option (unless you want a border).

          • Go to the Formatting tab and ensure the "Height" and "Width" are set to a small value (e.g., 1 pixel) so it doesn't take up visible space on the form.

          • Click OK. 

        • Select the newly added web resource on the form.

        • In the "Web Resource" properties (usually on the right-hand side), go to the Events tab.

        • Click Add Handler.

        • For the Event, select OnLoad.

        • For the Function Name, enter the name of the JavaScript function in your web resource: hideOpenInNewWindow.

        • Check the "Pass execution context as first parameter" option.

        • Click OK.

        • Save and then Publish the form.

        •  
          

    Explanation of the Code:

    • function hideOpenInNewWindow() { ... }: This defines the JavaScript function that will be executed when the form loads.

    • setTimeout(function() { ... }, 100);: This introduces a small delay (100 milliseconds) before trying to find and hide the button. This is important because the DOM (Document Object Model) of the form and its elements might not be fully loaded and rendered immediately when the OnLoad event fires. Adjust the timeout value if you find it's not consistently working.

    • document.querySelector("button[aria-label='Open in new window']"): This line uses a CSS selector to find the HTML button element that has the aria-label attribute set to "Open in new window". This is a reliable way to target this specific button provided Microsoft doesn't change the aria-label.

    • if (openInNewWindowButton) { ... }: This checks if the button element was found.

    • openInNewWindowButton.style.display = 'none';: If the button is found, this line sets its display style to none, effectively hiding it from view.


    •  

    Important Considerations:

    • Performance: While this approach is generally acceptable, adding a web resource and executing JavaScript on every form load can have a slight impact on performance. Ensure your JavaScript is efficient.

    • Maintainability: If Microsoft changes the aria-label of the "Open in new window" button in a future update, this script will stop working, and you'll need to update the CSS selector. Keep an eye on release notes and test after major updates.

    • Scope: You need to repeat step 2 for every Main form in every entity where you want to hide this button. There's no global setting to disable it for all forms at once through customization.

    • User Experience: Consider why you want to hide this button. Understand the potential impact on users who might rely on it for multi-tasking or comparing records. Ensure there's a valid business reason for this change.

    •  

    Alternative (Less Recommended for Global Hiding):

    While not a direct way to hide the button, you could potentially educate users on alternative ways to open records in new tabs or windows using their browser's right-click context menu or keyboard shortcuts (e.g., Ctrl+Click or Cmd+Click). However, this doesn't fulfill the requirement of hiding the button itself.

    By following the JavaScript and web resource approach outlined above, you can effectively hide the "Open in new window" button from all your Dynamics 365 forms. Remember to test thoroughly after implementation.

     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more. If you have further questions, please feel free to contact me.
     
    My response was crafted with AI assistance and tailored to provide detailed and actionable guidance for your Microsoft Dynamics 365 query.
     
    Regards,
    Daivat Vartak

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 143

#2
DAnny3211 Profile Picture

DAnny3211 134

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans