简体   繁体   English

MS Dynamics 365-Iframe-Access Xrm-权限被拒绝

[英]MS Dynamics 365 - Iframe - Access Xrm - permission denied

I have problem with integration between MS Dynamics CRM and my javascript app. 我在MS Dynamics CRM和我的javascript应用程序之间集成时遇到问题。

I need to setup communication between Opportunity page and my app in the iFrame. 我需要在iFrame中设置“机会”页面和我的应用之间的通信。

Problem is that when I need to access XRM object in the page, I alway get Access Denied Error 问题是,当我需要访问页面中的XRM对象时,总是出现“ Access Denied错误

I tried: 我试过了:

parent.window.Xrm.Page.data.entity.attributes.get(“stateCode”).getValue();

When I call this function from IE Dev tool then it works fine. 当我从IE Dev工具调用此函数时,它可以正常工作。 But from my JS app it throws Access Denied. 但是从我的JS应用程序中,它抛出“访问被拒绝”。

I read a lot about the iFrame integration but none works with MS Dynamics 365. 我阅读了很多有关iFrame集成的信息,但都不适用于MS Dynamics 365。

The problem with "Access Denied" may be related with CORS policy if your JavaScript app is hosted outside Dynamics environment. 如果您的JavaScript应用程序托管在Dynamics环境之外,则“访问被拒绝”问题可能与CORS策略有关。 To avoid this problem on one of my projects we were using postMessage API ( https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage ) instead of direct access to DOM model to send/receive messages between CRM form and IFRAME site. 为了避免在我的一个项目中出现此问题,我们使用了PostMessage API( https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage ),而不是直接访问DOM模型进行发送/接收CRM表单和IFRAME网站之间的消息。

I've written blog article describing how to make it work (unfortunately it is in Polish, but maybe some automatic translation will help;)): http://xrmlabs.piotrgaszewski.pl/?p=455 我已经写了一篇博客文章,描述了如何使其工作(不幸的是,它是波兰语,但也许有些自动翻译会有所帮助;)): http : //xrmlabs.piotrgaszewski.pl/?p=455

The parent.window of the HTML web resource that is loaded in an IFrame on a CRM form is actually not the form's window. 在CRM表单的IFrame中加载的HTML Web资源的parent.window实际上不是表单的窗口。 In fact, in Turbo Forms mode it is not possible to access the form's window using the DOM. 实际上,在Turbo表单模式下,无法使用DOM访问表单的窗口。

There are a few other options: 还有其他一些选择:

  1. Pass the entity id and name to the HTML web resource ( MSDN ) and query other data needed on your custom page using the web api. 将实体ID和名称传递到HTML Web资源( MSDN ),并使用Web API查询自定义页面上所需的其他数据。
  2. Access the web resource from a script on your form and push the data to your custom page. 从表单上的脚本访问Web资源,然后将数据推送到自定义页面。 (Note: do not use document.write as it will not work on every browser.) (注意:请不要使用document.write,因为它不适用于所有浏览器。)
  3. Turn turbo forms off (Settings -> Administration -> System Settings -> General -> Use legacy form rendering). 关闭涡轮增压表单(设置->管理->系统设置->常规->使用旧版表单呈现)。 This is not recommended, because you will turn it off for all entity forms and it will not provide a durable solution. 不建议这样做,因为您将对所有实体表单将其关闭,并且它不会提供持久的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Dynamics CRM 365 - 无法访问HTML Web资源中的Xrm.Page.entity - Dynamics CRM 365 - Cannot access Xrm.Page.entity in HTML web ressource 访问 IFRAME 中的属性的权限被拒绝 - Permission denied to access property in IFRAME 如何使用Xrm(Dynamics 365)在主题树中添加新项目 - How to add in the subject tree a new item with Xrm (Dynamics 365) Xrm.Page.getControl() 在 Dynamics 365 Sales Hub 中不起作用 - Xrm.Page.getControl() not working in Dynamics 365 Sales Hub 在Dynamics 365 CRM上使用Xrm Object将表单设置为只读 - Set form read only using Xrm Object on Dynamics 365 CRM iFrame 中的 SelectionContext - 访问属性“getSelection”的权限被拒绝 - SelectionContext in iFrame - Permission denied to access property ‘getSelection’ iframe中拒绝跨域访问权限 - Cross domain access permission denied in iframe 访问属性“filepicker_comm_iframe”的权限被拒绝 - Permission denied to access property 'filepicker_comm_iframe' 无法访问我的iFrame中的值,它允许我被拒绝 - Cant access values inside my iFrame it gives me permission denied 在 Dynamics 365 XRM Web API 中创建记录时无法设置多选选项字段 - Cannot set multi-select option field when creating record in Dynamics 365 XRM Web API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM