How to enable Rich Text in Dynamics CRM using CKEditor

This post has been moved to a new site. Please update your links to this location instead:

Comments (9)

  1. sabir says:

    Hi ,
    This article to use the Rich text can u plz let me know why ur using the look up field in the code, I why we need to have the look up.\\


    1. Hi Sabir – are you talking about this?
      var fieldsToReplace = [“company_textmodulebackingfield”, “company_textmodule2backingfield”];

      The reason I used an array here was to enable replacing multiple fields with rich text boxes on the same page without needing to modify the code to do it.. Was that your question? If not, could you let me know which part of the code wasn’t clear? I’m happy to help!

  2. Vittorio Cicognani says:

    I’m sorry but I have the same error on line 22, ReferenceError: ‘convertToRichText’ is undefined at eval code.

    I take a look at the script with this debugger and it seems
    that this line is wrong
    for (var i = 0; i’).style.display = “none”;

    It seems a syntax error…can you tell me how to correct this?

    Thank you
    Vittorio Cicognani

    1. Hi Vittorio – yes, the code is incorrect now. I’m not exactly sure what happened, let me see if I can find the code and get this corrected… I’ll let you know as soon as it’s fixed!

      1. I was just able to fix the code, let me know if you have trouble!

  3. Dotch says:


    Thanks for your article, it’s very helpfull.
    I got a problem when I had several rich text on the same form.
    Indeed, only the last field to replace is working well.

    I have two field to replace “acc_description”, “acc_topline”, when I made a modification in the first field, the form doesn’t understand I made a change and the automatic saving is not triggered.
    The second one works correctly.
    Do you have an idea ?
    I didn’t made any changes on your code.
    Thanks for you help

    1. Hi Dotch – unfortunately I don’t have an environment anymore where I can debug the code to see if something isn’t working correctly… Feel free to send me an email to peter hauge microsoft com and we can work something out. Thanks!

  4. Hi Peter,

    I implemented the JS code exactly as you have it above and attached it to the Lead main form onFormLoad event. It works great to give the Description a little CK Editor for editing in rich text. Thanks!

    The reason I was looking for this is because I have set up an Email to Lead Creation using a Queue and Auto Create Record Rule, and the email message/body appears in the Lead Description field with all the HTML tags. Ideally I’d like to strip the HTML tags and just have plain text, although your method of displaying it as rich text is also appealing.

    For the specific scenario I am using this for, I noticed a couple of limitations and wondering if you have any thoughts on workaround or solution?

    1) I cannot save any changes in the CK Editor / Description field. Dynamics does not recognize it as a changed field when editing inside the CK Editor. When I click away from the CK Editor, it goes back to the previous version with all HTML tags and no changes are saved.

    2) All the HTML tags are still displayed in the field (fed from my email Description to Lead creation) until the user clicks inside the Description field, so I assume it is still storing all the HTML tags in the DB? If that’s the case, we would need to strip out the HTML tags for reporting. Is there a way to save it as text in the DB without the HTML tags?


    1. Hi Sally – sorry for the delay responding! I think we can accomplish what you’re expecting with some adjustments in the javascript… Basically with some additional backing fields, in the callbacks on changes you can update both the HTML and text-based fields so you have both available. Please email me at p e t e r ( d o t ) h a u g e ( a t ) m i c r o s o f t ( d o t ) c o m , and we can discuss further.. Thanks!

Skip to main content