Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

cannot read property 'Page' of undefined

(0) ShareShare
ReportReport
Posted on by 12

Hey guys,

I'm trying to get a TinyMCE rich text editor as a popup in my email form (the Alexander Development.net solution) working. Unfortunately I'm having trouble with catching the value of the email description (/body) into a variable this way:

var emailBody = parent.frames[0].Xrm.Page.getAttribute("description").getValue();

It returns this nice "Cannot read property 'Page' of undefined" error, while I was pretty sure this was the 2016 way of getting it done.
Since I'm not much of a javascript developer (obviously), I'm kind of stuck.

Anybody got a better idea or anyone knows how to get the description into the variable? It's building even before the popup is called, so I figured 'parent' would do the job (being the parent of the html web resource).. but clearly I'm wrong.

Any ideas?

thanks in advance!
Regards,

Jeroen

*This post is locked for comments

  • Jeroen J Profile Picture
    12 on at
    RE: cannot read property 'Page' of undefined

    Hey David,

    thanks for your quick reply! It worked as a charm!

  • Verified answer
    David Jennaway Profile Picture
    14,065 on at
    RE: cannot read property 'Page' of undefined

    I think your problem is that there may be several frames within the parent object, whereas your code assumes that the email description is in the first one (frames[0]). Instead, try looping through each frame in turn, like below:

    var emailBody;
    for (var i=0;i<parent.frames.length;i++)
    {
     if (parent.frames[i].Xrm != null && parent.frames[i].Xrm.Page != null)
     {
      var ctl = parent.frames[i].Xrm.Page.getAttribute("description");
      if (ctl != null)
      {
       emailBody = ctl.getValue();
       break;
      }
     }
    }
    


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 the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 54

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans