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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Window.ShowModalDialog vs Window.Open

(0) ShareShare
ReportReport
Posted on by 5

Hi All,

We are using MS Dynamics 365 On-Premise version 8.2. 

Our client also has old application running on MS Dynamics 2011. Now they are facing issue with "Window.ShowModalDialog()" in the Dyanmcis 2011 application. Here is the query:

We’re having a problem in some of our CRM where in the old code we had written uses Window.ShowModalDialog but that is no longer supported by the latest updates to Chrome and Edge.

var popup = window.showModalDialog(Xrm.Page.context.getClientUrl() + "/WebResources/cmm_sendemail.htm", this, 'center:yes;unadorned:yes;resizable:1;dialogHeight:60px;dialogwidth:550px;scroll:no;status=no');

So we have to use window.open

var popup = window.open(Xrm.Page.context.getClientUrl() + "/WebResources/cmm_sendemail.htm", "Send Email", "center=yes,height=60,width=550,scrollbars=no,resizable=no");

How do we pass the form context (“this”) to the HTML page so we can extract EntityID, EntityName, etc.? Do we have to send each one individually or can we send the whole form context and extract it by element name on the HTML page?
Because this will no longer work since there is no dialogArguments being passed.

var entityId = window.dialogArguments.Xrm.Page.data.entity.getId();
var entityName = window.dialogArguments.Xrm.Page.data.entity.getEntityName();

I have the same question (0)
  • Suggested answer
    sdfasdf Profile Picture
    842 on at

    I'm afraid using showModalDialog is supported anymore: docs.microsoft.com/.../open-forms-views-dialogs-reports-url

    As far as your query, you may want to use parent.Xrm from within your Web resource -- docs.microsoft.com/.../important-changes-coming

  • Suggested answer
    Charles Abi Khirs Profile Picture
    3,569 on at

    Hello,

    If you are opening the html page from a ribbon button, you can check the following link for details how to pass it: community.dynamics.com/.../getting-dynamics-365-formcontext-from-ribbon-workbench

    If you are opening it on the form, you can use parent.Xrm.Page

  • Abhijeet Bhosale Profile Picture
    5 on at

    Hi Charles,

    Thanks for your reply.

    I am not sure from where our client is trying to open the html.

    I am assuming from the written code that he is trying to open html page from JS and he wants to pass "this" object i.e. form context to the html page (web resource). so that he can extract entity id and other information in that html.

    The way we used to pass "this" in ShowModalDialog(), he wants alternate way to ShowModal now.

    Can we achieve the same using Xrm.Navigation.openWebResource() ? 

    Regards,

    Abhijeet Bhosale

  • Abhijeet Bhosale Profile Picture
    5 on at

    Hello Nathan,

    Thanks for your reply.

    You are right. This is what the issue is. ShowModalDialog() is no more supported by chrome. We need alternate way to achieve ShowModalDialog functionality. I have mentioned the code what user is trying to to.

    He wants to pass "this" (form context) object to web resource (html).

    Can we achieve the same using Xrm.Navigation.openWebResource() ?

    Regards,

    Abhijeet Bhosale

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans