Reputation: 95
I have problem with integration between MS Dynamics CRM and my javascript app.
I need to setup communication between Opportunity page and my app in the iFrame.
Problem is that when I need to access XRM object in the page, I alway get Access Denied
Error
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. But from my JS app it throws Access Denied.
I read a lot about the iFrame integration but none works with MS Dynamics 365.
Upvotes: 0
Views: 1422
Reputation: 343
The problem with "Access Denied" may be related with CORS policy if your JavaScript app is hosted outside Dynamics environment. 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.
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
Upvotes: 2
Reputation: 7918
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. In fact, in Turbo Forms mode it is not possible to access the form's window using the DOM.
There are a few other options:
Upvotes: 1