0

I want to open dialog in Dynamics CRM with javascript function, for internal sources I use:

function openModalForm(url) {

    var DialogOption = new Xrm.DialogOptions();
    DialogOption.width = 500;
    DialogOption.height = 260;
    Xrm.Internal.openDialog(url, DialogOption, null, null);

}

Now I need to open external urls like: url = 'http://www.yahoo.com/'

How could I open the external sources as dialog in Dynamics? any idea?

Saeid
  • 13,224
  • 32
  • 107
  • 173

2 Answers2

1

Essentially you are looking for a common method to open a browser window as a modal popup. Modern browsers do not support this anymore and it can only be achieved with some tricks/libs/workarounds (e.g. see this post on SO.)

Personally I have given up on this and accept that window.open() just opens windows modeless. A better technique would be modal CSS-dialogs, which in modern web development would be the preferred way to go. However, in Dynamics CRM custom CSS dialogs require fiddling with the DOM, which is not a supported customization.

Henk van Boeijen
  • 7,357
  • 6
  • 32
  • 42
0

You can embed an IFRAME into your CRM form named, for example new_iframecontainer.

Then on load of your form, you can use the Xrm function setSrc like so:

Xrm.Page.getControl("new_iframecontainer").setSrc("www.yahoo.com");

An alternative solution would be to pass an encoded URL to an HTML web resource using openWebResource. Then in the HTML web resource, redirect to the URL that was passed. This blog post covers how this approach can be acheived.

jcjr
  • 1,503
  • 24
  • 40
Dave Clark
  • 2,243
  • 15
  • 32
  • Thank you! the problem is for both solutions there not like dialog, it is like the iframe in the page or new window – Saeid Aug 21 '17 at 17:53