Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

RE: Help with transitioning away from Xrm.Page

(0) ShareShare
ReportReport
Posted on by 35

[quote user="wperkinson3"]

Good afternoon,

I am testing our Dynamics environment under version 9.0 and I am finding several custom Javascripts are not working due to the use of Xrm.Page

Can someone guide me on how to proceed in converting such functions as the following?

Thank you,

Will

============================

function addTask() {
 Xrm.Utility.openEntityForm('task', null, {
  pId: Xrm.Page.data.entity.getId().replace(/{|}/g, ''),
  pType: Mscrm.EntityPropUtil.EntityTypeName2CodeMap[Xrm.Page.data.entity.getEntityName()],
  pName: Xrm.Page.getAttribute('name').getValue()
 });
}

[/quote]

How to get executionContext or formContext in HTML Web Resource?

*This post is locked for comments

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: RE: Help with transitioning away from Xrm.Page

    Hi,

    Please find below reference for all deprecated method.

    docs.microsoft.com/.../xrm-utility

    Xrm.Utility.openEntityForm has been deprecated with Xrm.Navigation.openForm.

    Now the point is from where you are invoking the method.

    You can refer below article how to pass formcontext using Ribbon.

    www.inogic.com/.../java-script-execution-context-provides-form-values-on-web-as-well-as-uci-in-dynamics-365-v9-0

    The way you retrieved entity type code is not a supported method , So you can use API to retrieve entoty metadata .

    Please refer below article -

    www.inogic.com/.../retrieve-metadata-using-name-in-web-api

    You can still use parent.Xrm to access the parent fields. As of now there is no way to get formcontext from HTML. MS announce to be deprecated Xrm.Page in future major release  and during this time you can use Xrm.Page. Here is one old thread where I have answered clearly.

    community.dynamics.com/.../275459

    Hope this helps.

  • Suggested answer
    Arun Vinoth Profile Picture
    Arun Vinoth 11,613 on at
    RE: RE: Help with transitioning away from Xrm.Page

    Refer this: docs.microsoft.com/.../getglobalcontext-clientglobalcontext.js.aspx

    You have to refer GetGlobalContext method using clientglobalcontext.js reference to use global context.

    For form context, you have to use parent.Xrm or window.opener.Xrm based on how you open the html web resource to access it.

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans