Share via


How to enable Rich Text in Dynamics CRM using CKEditor

This post unfortunately needed to be re-posted here to resolve issues with the code.  Sorry for any confusion!

https://blogs.msdn.microsoft.com/peterhauge/2017/06/08/how-to-enable-rich-text-in-dynamics-crm-using-ckeditor-2/

Comments

  • Anonymous
    October 07, 2015
    Nice job Peter this is very cool!

  • Anonymous
    November 20, 2015
    Great post Peter.  I got it working but I want to add the ability to pick the text color. Is there a way to add the CKEditor plugins with your method?

  • Anonymous
    November 20, 2015
    The comment has been removed

  • Anonymous
    December 02, 2015
    Changing the URL for the editor worked great. I now see the full editor with text color. I have another issue now. When I type in the editor it is not updating the underlying field. So the CRM doesn't think the record is dirty and does not save my changes. Any advice on that one?

  • Anonymous
    December 02, 2015
    The comment has been removed

  • Anonymous
    December 10, 2015
    Hey Peter, thanks for the interresting article. I see the CKEditor in the form, but unfortunately it doesn't save the content. I noticed that everytime I press a key in the editor, I get an "Uncaught TypeError: Cannot read property 'call' of undefined". The error is thrown from ckeditor.js. Currently I'm working with Microsoft Dynamics® CRM 2016. Have you tried the CKEditor with the new CRM already? Or do you have any ideas how to make it working? Best regards!

  • Anonymous
    December 10, 2015
    Hi Patrick - good question, I haven't tried this on Dynamics CRM 2016 yet, we are upgrading probably in Jan sometime...  I bet it's because the page is structured slightly different.  I'm happy to help further, but we should probably take the conversation out of blog comments - you can email me directly at peter dot hauge at microsoft dot com if you want to dig further. :-)  Thanks!

  • Anonymous
    February 08, 2016
    Good news - I just got this working on the latest Dynamics CRM online!  I updated the code above, thanks to Anton Kurnitzky for his help!

  • Anonymous
    February 21, 2016
    Hello Peter, Thanks a lot for this!! We were able to get ckeditor working in our crm form using your guidance... We have just one issue now...the CRM field shows the HTML markup text...and not the rich text editing when form loads... Only when we click on the field...does the Ckeditor showup...any suggestions on how to get around this?

  • Anonymous
    February 22, 2016
    Great - really glad it was helpful!  My best guess is that the script block is loading faster than the other UI elements on the page, but probably can't really diagnose without seeing it.  Feel free to reach out directly (my email is in one of the prior comments) and we can work through it.

    • Anonymous
      March 23, 2016
      Hi Peter,Excellent page! I'd been using the CKEditor via an html webresource previously, but after an upgrade to CRM 2016, this no longer worked. Your tips worked like a charm and was much easier to set up! If only this page had been available when I set it up in the first place ;)I have a similar issue as Sumeet - if focus is on any other field than the description field, it reverts to showing the HTML markup text instead of the rich text editor. It's no big deal, as the editor returns once focus returns to the field, I was just wondering if you might have any ideas as to what is happening?Thanks for a great post :)
      • Anonymous
        April 26, 2016
        The comment has been removed
  • Anonymous
    March 23, 2016
    This method uses document.getElementById(), rendering it unsupported. Do you have a recommended way of implementing the CKEditor in a supported fashion?

    • Anonymous
      March 23, 2016
      Just clarifying that the use of document.getElementById() on its own is not unsupported, but using it to manipulate the form is.
      • Anonymous
        April 26, 2016
        The comment has been removed
  • Anonymous
    June 10, 2016
    Thank you so much for this post it has been extremely useful, and I can see the editor when I load my form. I then tried to change to the full version and when I went into the form again the web resource was not there, but if I go to Web Resources entity it is there. I altered it in the Web Resources entity and published but it has not updated the form. Can you giveme any idea why this would be?Many thanks

  • Anonymous
    June 10, 2016
    I have followed the step above and I have received the following error convertToRichText is undefined at eval code {eval code 1:1)Any guidance would be greatly appreciatedThe log file shows thisReferenceError: 'ConvertToRichText' is undefined at eval code (eval code:1:1) at RunHandlerInternal (https://sno.crm4.dynamics.com/form/ClientApiWrapper.aspx?ver=1640910717:156:1) at RunHandlers (https://sno.crm4.dynamics.com/form/ClientApiWrapper.aspx?ver=1640910717:115:1) at Anonymous function (https://sno.crm4.dynamics.com/form/ClientApiWrapper.aspx?ver=1640910717:99:63) at Anonymous function (https://sno.crm4.dynamics.com/_static/_common/scripts/MicrosoftAjax.js?ver=1640910717:1:294)

    • Anonymous
      June 10, 2016
      Using CRM online 2016 fresh installation. I have tried to set the legacy from rendering option, but this has not solved the errortxs
    • Anonymous
      June 10, 2016
      The comment has been removed
    • Anonymous
      June 13, 2016
      Hi Idalette, I saw you sent me email directly, thanks! Just post back here with the solution once we figure it out. :-)
      • Anonymous
        June 20, 2016
        I'm getting the same error message as Idalette. Let me know if you find a resolution. (I'm using CRM Online 2016 Update 1 with Project Services Automation).
        • Anonymous
          June 20, 2016
          Hi Neil - Idalette decided to go another route (use another browser for clickable links)... I can help debug, could you drop me an email and we can go from there? peter dot hauge at Microsoft dot com. Thanks!
  • Anonymous
    June 15, 2016
    This looks promising, but I am getting a "Unable to get property 'getEditor' of undefined or null reference" error and the editor controls don't show up... any ideas? This is for CRM 2013 on-premise.

    • Anonymous
      June 15, 2016
      Hi Nick - I've seen that error before when JQuery wasn't loaded properly, or the CKEditor wasn't initialized. Feel free to connect with me at peter dot hauge at Microsoft dot com and we can go through it together. Thanks!
  • Anonymous
    April 06, 2017
    Hello,You solution is good however i have found a few problems with CRM 2016 Online.On the initial load of the form the script doesn't work correctly as the ckeditor javascript hasnt fully loaded yet so you get a TypeError: Cannot call method 'getEditor' of undefined. However once you reload the form it works as intented.Another problem i have found with your script is that when using multiple fields it doesn't work as expected. I have trying doing this with 3 fields however it only works on the last field in the array, also the other 2 fields won't save and only show the Rich Text Editor when you focus on them.I have developed the script to be working with multiple fields however i can seem to fix the problem of loading the form for the first time.We can communicate if you would like to come up with a solution.

    • Anonymous
      April 17, 2017
      Hi Timothy - thanks for checking this out! I got your mail and replied... Let us know if the updated code works, if so I can update the blog post directly with the info. Thanks!
      • Anonymous
        April 17, 2017
        Hello Peter,First of all thank you so much for this blog . We are also facing the same issue ,the ckeditor instances are not loading on the initial load but once we refresh the CRM form the CKeditor instances are loading fine . Please help us with the updated code.Note : This was working fine when turbo was not enabled . Once we enabled turbo forms we are facing this issue .
        • Anonymous
          April 17, 2017
          Just updated the code in the post - let me know if you have any trouble!
          • Anonymous
            April 18, 2017
            Wow !!. This worked like a charm .Thank you so much Sir !!
          • Anonymous
            May 10, 2017
            Hello Peter, I am just checking your code again in this blog and it seems to be incorrect.You may need to update it with your latest code.I have also ran into another issue where if someone click on the expand or source toolbar button in ck editor and then saves the form in a https environment the field reverts back to a normal field until you enter the field again in which it will then go back to a CK Editor field
  • Anonymous
    April 14, 2017
    Hi Peter,This is a very handy solution. Can it be utilized anyhow for Notes editor? I cannot find any way to access notes editor.

    • Anonymous
      April 17, 2017
      Hi Marie - I haven't tried with the notes editor unfortunately. As far as I've gone with my experimenting it works with any fields that are stored as plain text in CRM. If you want to look into this together just send me some email (check the other comments for my email address) and we can look into it. Thanks!
  • Anonymous
    May 22, 2017
    The comment has been removed

    • Anonymous
      May 22, 2017
      Thanks for letting me know! I'll check this out and fix soon, thanks!
  • Anonymous
    June 08, 2017
    Just an FYI - there was an issue with the wordpress dashboard mangling the code so I had to re-post this to a new location entirely. You can find that here: https://blogs.msdn.microsoft.com/peterhauge/2017/06/08/how-to-enable-rich-text-in-dynamics-crm-using-ckeditor-2/ . Thanks!