Hi,
We have created custom html page, in that we used parent.Xrm till now is it working but as per Microsoft parent.Xrm is deprecated in version 9. So what is the alternative for this.
Thanks!
*This post is locked for comments
Hi,
We have created custom html page, in that we used parent.Xrm till now is it working but as per Microsoft parent.Xrm is deprecated in version 9. So what is the alternative for this.
Thanks!
*This post is locked for comments
thank you.
Hi Zhenyu Wang,
parent.Xrm.Page will continue to work if the HTML web resource is loaded in a form container but it will not work for HTML web resources that are stand alone, or referenced from the site map or any other places like it used to. It is possible that Microsoft are working on a good alternative Replacement Client API for parent.Xrm or that they want to limit the functionality for one reason or another, but this is yet to be confirmed.
Hi Adrian,
Thanks a lot for quick reply.
I think Xrm.Page is deprecated.
However parent.Xrm.Page is not yet. And it is still the best practise to use parent.Xrm.Page.
According to this docs page:
docs.microsoft.com/.../important-changes-coming
Same with Tomas mentioned on the previous reply, 'parent.Xrm.Page will continue to work'
I am looking for a equivalent replacement, otherwise how can a function being deprecated without a replacement.
Or maybe Microsoft need to update its document page.
Hi Zhenyu Wang,
parent.xrm is deprecated in Dynamics 365 Customer Engagement as of version 9. There is no equivalent Replacement Client API.
Earlier: An HTML web resource may interact with the Xrm.Page or Xrm.Utility objects within the form by using parent.Xrm.Page or parent.Xrm.Utility.
Now: parent.Xrm.* will work if the HTML web resource is loaded in a form container. It won't work for HTML web resources that are stand alone, or referenced from the site map or any other places.
So, what is the replacement of parent.Xrm.Page?
I don't think parent.ExecutionContextObj.getFormContext() has value.
Maybe there is another methold?
Hi everyone,
Microsoft have published a replacement Client API called getFormContext and information on it is available here. Xrm.Page will continue to be available and supported until its official removal in a future major release of Dynamics 365.
Microsoft will publish an alternative at the time of removal. As of now we are still good to use Xrm.Page
Hi,
As per Microsoft website, CRM V9 will support Xrm.Page. But It will be removed in the future.
The alternative API is "ExecutionContext.getFormContext"
Steps:
1. Click on "Pass Execution context as first parameter" in the Event Handker properties
(see image below)
2. Then get the Execution context as a function parameter
eg: function SampleFunction(executionContext){
3. Create formContext variable
var formContext = executionContext.getFormContext();
4. Replace Xrm.Page with formContext
// var asset=Xrm.Page.getAttribute("sample_asset");
var asset = formContext.getAttribute("sample_asset");
Hi ,
Can you please debug and check once ?
I'm using it for v9.0 only and its working fine for me as well.
ex.
var lookupItem = parent.Xrm.Page.getAttribute("contact").getValue();
Hi, there is an update for this in docs:
Use of the Xrm.Page object as a static access to the primary form context is still supported to maintain backward compatibility with the existing scripts. Based on the feedback, we understand that the usage of Xrm.Page is high, and it won’t be removed as soon as some other client API methods listed in this section. We encourage you to use the new way of getting form content where possible.
Although Xrm.Page is deprecated, parent.Xrm.Page will continue to work in case of HTML web resources embedded in forms as this is the only way to access the form context from the HTML web resource.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,269 Super User 2024 Season 2
Martin Dráb 230,198 Most Valuable Professional
nmaenpaa 101,156