Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

parent.Xrm Deprecation in version 9

Posted on by 680

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

  • Zhenyu Wang Profile Picture
    Zhenyu Wang on at
    RE: parent.Xrm Deprecation in version 9

    thank you.

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: parent.Xrm Deprecation in version 9

    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.

  • Zhenyu Wang Profile Picture
    Zhenyu Wang on at
    RE: parent.Xrm Deprecation in version 9

    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.

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: parent.Xrm Deprecation in version 9

    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.

  • Zhenyu Wang Profile Picture
    Zhenyu Wang on at
    RE: parent.Xrm Deprecation in version 9

    So, what is the replacement of parent.Xrm.Page?

    I don't think parent.ExecutionContextObj.getFormContext() has value.

    Maybe there is another methold?

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: parent.Xrm Deprecation in version 9

    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.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: parent.Xrm Deprecation in version 9

    Microsoft will publish an alternative at the time of removal. As of now we are still good to use Xrm.Page

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: parent.Xrm Deprecation in version 9

    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");

     

    Pass-Execution-Context.PNG

     

  • Suggested answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,227 on at
    RE: parent.Xrm Deprecation in version 9

    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();

    7433.a.JPG

  • Suggested answer
    Tomas Prokop Profile Picture
    Tomas Prokop 590 on at
    RE: parent.Xrm Deprecation in version 9

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans