Monday, January 28, 2019

Dynamics 365–Open URL in a new window from SiteMap

The way I have found to be able to do this is by adding a web-resource HTML file with the following code:

<html>
     <head>

        <title>New Window</title>
     </head>

    <body>
         <script type="text/javascript">
             function OpenWindow(url)
             {
                 debugger;
               var newWindow = window.open(url,"_blank");
               window.history.back();
               if (window.focus) {
                       newWindow.focus();
                   }
             }
             debugger;
             window.onload=OpenWindow("https://www.bing.com");
         </script>
         Opening new window….
     </body>
</html>

Then add a web-resource sub-item onto the SiteMap and point it at the web resource. That should do it!

Note about UCI: in UCI, a URL always opens in a new window, which is a change in behavior from the web-legacy interface and so you dont need the above hack to open the URL in a new window