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)

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

I have the same question (0)
  • Verified answer
    David Jennaway Profile Picture
    14,065 on at

    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;
      }
     }
    }
    


  • Jeroen J Profile Picture
    12 on at

    Hey David,

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

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