Method Xrm.Utility.openDialog is deprecated, but why?

拜拜、爱过 提交于 2019-12-24 14:34:35

问题


Method Xrm.Utility.openDialog() is deprecated, but I can't find any information about this method, and any alternative for this?

Can you help me to find alternative method for openDialog()?


回答1:


As far as I know there has never been a function called Xrm.Utility.openDialog().

A few years ago developers used window.showModalDialog() to open custom modal windows from within Dynamics CRM. However, popular browsers like Chrome stopped supporting this function, which had been an IE invention anyway. Modal dialogs block access to the main opening window and harm user experience on tablets and smart phone interfaces, so nowadays they are considered to be a bad design choice.

As an alternative some Dynamics CRM developers started using the internal function Xrm.Internal.openDialog(). Nevertheless this function has never been part of the supported API and should not be used.

An alternative would be to inject een IFrame at the end of the body of the page and display your dialog in it. This is the way built-in Dynamics CRM dialogs currently are implemented.




回答2:


Microsoft told me what I must use Xrm.Utility.openWebResource() method. Thank you




回答3:


we have a custom ribbon button that runs a dialog on demand using JavaScript. This is a snippet of the code that you may find useful. We do not use .openDialog().

window.open(
    Xrm.Page.context.getClientUrl() + "/cs/dialog/rundialog.aspx?DialogId="
    + encodeURIComponent(DIALOG_ID)
    + "&EntityName=new_entityname&ObjectId=" + encodeURIComponent(ENTITY_ID),
    "formRibbon_runDialog_" + DIALOG_ID + "_" + ENTITY_ID,
    "height=480, width=615"
);

It is also worth noting that Dialogs in general are deprecated by Microsoft, but it will likely be many years until they are truly removed from the system so it's not much to worry about.

Let me know if you have any questions.



来源:https://stackoverflow.com/questions/50972516/method-xrm-utility-opendialog-is-deprecated-but-why

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!