web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
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

I have the same question (0)
  • Suggested answer
    Arun Vinoth Profile Picture
    11,615 Moderator 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.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator 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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Wayne Walton Profile Picture

Wayne Walton 2

#2
Good.Panos Profile Picture

Good.Panos 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans