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.ui is null when debugging with F12

(0) ShareShare
ReportReport
Posted on by 420

I try to write some Javascript using the f12 tool. In the console if I write console.log(Xrm.Page) I get 

Æ’ () {
}
if I write Xrm.Page.ui instead I get null. According to this article I should be able to use the console to test javascript : https://msdn.microsoft.com/en-us/library/gg328261.aspx#BKMK_DeveloperTools
I am doing this in the form of a custom entity. Anyone know what I'm doing wrong?

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Xrm.Page.ui is null when debugging with F12

    [quote user="anonsgate"]

    If you want a quicker way to test, you can put your "context" at contentIFrame1. In chrome, if you press F12, you will see "top" written in a dropdown. click it and choose contentIFrame1 instead. You can now use Xrm.Page in the console. Note that sometimes it's contentIFrame0

    [/quote]

    @anonsgate you are a genius. Thanks! this was great help.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Xrm.Page.ui is null when debugging with F12

    Oh yes, Chrome has better Developer Tools, that makes it so much easier. Thanks

  • Verified answer
    anonsgate Profile Picture
    anonsgate 420 on at
    RE: Xrm.Page.ui is null when debugging with F12

    If you want a quicker way to test, you can put your "context" at contentIFrame1. In chrome, if you press F12, you will see "top" written in a dropdown. click it and choose contentIFrame1 instead. You can now use Xrm.Page in the console. Note that sometimes it's contentIFrame0

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Xrm.Page.ui is null when debugging with F12

    Spent 2 hours googling, finally got to this thread! Thank you very much! :-)

  • anonsgate Profile Picture
    anonsgate 420 on at
    RE: Xrm.Page.ui is null when debugging with F12

    Thanks it worked!

  • Verified answer
    ashlega Profile Picture
    ashlega 34,477 on at
    RE: Xrm.Page.ui is null when debugging with F12

    It seems the "console" does not put you in the right context.

    Try

    document.contentIFrame1.Xrm.Page.ui

    You don't have to do it when using web resources, though.

  • anonsgate Profile Picture
    anonsgate 420 on at
    RE: Xrm.Page.ui is null when debugging with F12

    Yes I'm inside the record. I went to the list of that entity, double clicked one entry and now I'm in the form where I can edit the values of my entity like name,owner etc...

  • ashlega Profile Picture
    ashlega 34,477 on at
    RE: Xrm.Page.ui is null when debugging with F12

    Hi,

     have you opened a specific record in Dynamics, or are you looking at the view/dashboard?

    Xrm.Page will only be available on the "forms", not in the views/dashboards/reports/etc

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,309 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans