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

  • Community Member Profile Picture
    on at
    RE: Xrm.Page.data Property is NULL when used inside Webresource embedded on a Form

    This is the information I needed. Thanks

  • Verified answer
    Aric Levin Profile Picture
    30,188 Moderator on at
    RE: Xrm.Page.data Property is NULL when used inside Webresource embedded on a Form

    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.

  • Verified answer
    Michel van den Brink Profile Picture
    4,697 on at
    RE: Xrm.Page.data Property is NULL when used inside Webresource embedded on a Form

    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 :-)

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,245 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,923 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans