DanWa
DanWa

Reputation: 21

Powerapps Xrm.WebApi in a stand alone Web Resource

I have a stand alone web resource linked from the site menu in a Model Driven App. It does multiple api calls using parent.Xrm.WebApi and currently works fine.

According to Microsoft deprecation notice, https://learn.microsoft.com/en-us/power-platform/important-changes-coming, parent.Xrm will be going away and no longer work for standalone Web Resource. Xrm.WebApi without referencing the parent throws an error "Xrm" is not defined.

Can anyone help with a supported way to access Xrm.Utility and Xrm.WebApi from a standalone web resource?

Upvotes: 2

Views: 1459

Answers (1)

Latest documentation update:

The ClientGlobalContext.js.aspx page is deprecated and scheduled to be unavailable after April 1, 2022. Alternative methods to access global context information will be available by December, 2021.


On this particular piece, so far nothing documented as workaround or alternate solution from Microsoft. I created a github issue for the assistance and it is still open.

Between, I came to know about one of the MS employee unofficial side project and code sample from this blog. That is also about to be confirmed as supported.

A lot of organizations use ClientGlobalContext.js.aspx in HTML web resources, and this means you will want to upgrade those HTML web resources that utilize the ClientGlobalContext.js.aspx library as soon as possible.

If you are embedding HTML web resources in Dynamics 365 / Power Apps forms, you may want to look at using getContentWindow.

If you have stand-alone HTML web resources, or if you are embedding in forms and would like a neat way to swap out ClientGlobalContext.js.aspx with a new library, Microsoft employee Christopher Nichols has built a solution that may be of interest to you.

Christopher has a nice unofficial side project going on called mock-xrm that, as you can imagine, mocks xrm. This means we can call our Xrm functionality from within web resources that instead of the legacy aspx page.

All we have to do is just download the Xrm.min.js file as web resource and this has to be referred in our HTML web resource to consume Xrm the same way as earlier.

We can keep a close eye on this library and github issue for further updates and concrete communication.

Upvotes: 1

Related Questions