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

Announcements

No record found.

News and Announcements icon
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

  • Suggested answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at

    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

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans