Message.BodyText from BodyHTML

posted Sep 29, 2016, 6:59 AM by Eric Patrick   [ updated Sep 29, 2016, 7:04 AM ]
The Message class populates BodyText from BodyHTML (stripped of HTML tags) if not otherwise specified. This allows use of rich HTML for messages viewed from the web tier or email clients, while also providing plain text for use in reports or data exchange where HTML is not desirable.

  • This behavior is executed in the application tier by default
    • e.g. Message/Save?BodyHTML={html} will result in BodyHTML and BodyText both being populated
    • no changes are needed to the UI (web) tier
  • If BodyHTML and BodyText are both passed to Message/Save, the BodyText passed over the wire 'wins'
  • This behavior may be disabled from Design > Configuration > Modules > Message > Settings, changing SetTextFromHtml to false.
  • The MessageObject.HtmltoText(string html) method is used to strip text of HTML tags, and may be used elsewhere as a static method.
  • Test cases for this behavior are in qbo.Message.Test > MessageTests