Saeid
Saeid

Reputation: 13582

How to open external source as dialog in Dynamics CRM

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?

Upvotes: 0

Views: 1711

Answers (2)

Dave Clark
Dave Clark

Reputation: 2303

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.

Upvotes: 0

Henk van Boeijen
Henk van Boeijen

Reputation: 7918

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.

Upvotes: 1

Related Questions