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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Xrm.Page.data Property is NULL when used inside Webresource embedded on a Form

(0) ShareShare
ReportReport
Posted on by

I have a WebResource with html mark-up that draws a html button with an onclick event.  The onclick event calls a javascript function that tries to reference the data property on Xrm.Page.  The html webresource is embedded on a Form in a custom entity.

When I click the html button and debug the script I can see that Xrm.Page.data is NULL. 

I tried calling this same javascript function in the OnLoad event of Form. In this case the Xrm.Page.data property is not null.

 Should i expect the  Xrm.Page.data property to be NULL when embedded in a webreource on a form and populated when used in OnLoad event of the form?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Michel van den Brink Profile Picture
    4,697 on at

    Hello,

    When you embed a WebResource into an Entity Form, you need to go up one level, to reach the form first.

    Try:

    var entityDataInForm = parent.Xrm.Page;


      

    Note: this only works if you include the WebResource into the Entity Form with the WebResource component, it does not work with an iFrame.

      

    Hope this helps you. If you have any other questions, please let me know!

    If you found my answer helpful, please help the community by marking it as verified :-)

  • Verified answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Web resources are not in the same level as the actual CRM page.

    You can access the data class of Xrm.Page using parent.Xrm.Page.data or you can redefine Xrm inside you own web resource:

    var Xrm = parent.Xrm;

    After that you should be able to use: Xrm.Page.data...

    Hope this helps.

  • Community Member Profile Picture
    on at

    This is the information I needed. Thanks

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
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans