Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Error generated when attempting to insert email template

Posted on by 15

From a fresh email form, attempt to add an email template, and receive dialog indicating "An error has occurred. Please return to the home page and try again."  No additional information or detail.  I have administrator permissions.  Same effect regardless of a number of different conditions; behaviour the same  in IE, Chrome, and Firefox.

Templates work fine from the 'Send Direct Email' option.

We were just upgraded to D365.

Region_2D00_2016.gif

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error generated when attempting to insert email template

    Thank you so much Jochen.

    We started getting this error a few days ago on our tenant. Your fix worked for us too!

    Very frustrating, as we use templates extensively. 

  • LucaV Profile Picture
    LucaV 2 on at
    RE: Error generated when attempting to insert email template

    Thank you for your hints, by using Jochen's approach I was able to solve the issue with the templates today. I wonder if this is affecting all Dynamics 365 organizations...

  • RE: Error generated when attempting to insert email template

    Many thanks, very good hint. I have investigated a bit further and have come to a different solution. On form load of the Email I have added the following lines:

    function onLoadEmail() {

     document.QuerySelector = document.querySelector;

     parent.document.QuerySelector = parent.document.querySelector;

    }

    Template selection is working again.

    Now I'm wondering what has changed that yesterday template selection still worked fine and today ...

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error generated when attempting to insert email template

    Hi,

    I think it is a MS Dynamics CRM error..

    I inspect the element when we click the "Insert Template" button, I got the error hitting part in the code.

    0317.Screenshot-_2800_118_2900_.png

    There is an error in the  InsertValue() function in EmailBody.js file. 

     var descriptionEditIFrame = document.QuerySelector("[id$='descriptionEditIFrame']");
        if(IsNull(descriptionEditIFrame) && Xrm.Internal.isTurboForm())
            descriptionEditIFrame = window.parent.document.QuerySelector("[id$='descriptionEditIFrame']");

    This part is showing the error. So instead of this use,

     var descriptionEditIFrame = document.querySelector("[id$='descriptionEditIFrame']");
        if(IsNull(descriptionEditIFrame) && Xrm.Internal.isTurboForm())
            descriptionEditIFrame = window.parent.document.querySelector("[id$='descriptionEditIFrame']");

    Now it is working fine for me..

    0317.Screenshot-_2800_118_2900_.png

    I tried it by adding new button using ribbon workbench, and added new JavaScript web resource file(Content is copied from emailBody.js and made the above mentioned changes). Add this JavaScript file on the button click action and function name as "ApplyTemplate" .

    Thanks...

  • RE: Error generated when attempting to insert email template

    Found the same error today - yesterday templates still worked fine. Tried IE and FF.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans