Updating CRM online email description with jscript onload not working RRS feed

  • Question

  • I'm setting the value of the description attribute of a newly created reply email during the onload event.

    The setValue method works when the email is plain text but does not work when formatted.  When the email is formatted, the following message displays:
      "The e-mail below might contain script or content that is potentially harmful and has been blocked." 

    Is there a way to update the description via jscript when the above message is received? 

    Wednesday, September 4, 2013 9:15 PM

All replies

  • Use Javascript escape function to encode the formatted description.

    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Wednesday, September 4, 2013 10:39 PM
  • I'm not having an issue encoding or decoding the text in the description.

    Xrm.Page.getAttribute("description").getValue() and Xrm.Page.getAttribute("description").setValue() do not work if the email text is formatted.  The formatting could be HTML, word or even outlook formatting.  When the message is displayed, the text is not in the attribute and cannot be accessed via supported jscript.

    To recreate this scenario, create an email in CRM 2011.  Copy and paste formatted text from outlook, word or another processor.  Save the email.  Ensure you receive this message: "The e-mail below might contain script or content that is potentially harmful and has been blocked. Open Message"  

    Add a simple script to the onload event to display the description text in an alert.   Open the email previously saved.  

    This should show the email description is blocked from the browser and client-side scripting. 

    So I ask, is this a bug? Is there a work-around? Is this the expected result and I should not try to update the email description and leave it to templates?

    Thursday, September 5, 2013 3:18 PM