Text Rich Area Field In Flow

Text Rich Area Field In Flow

Rich Text fields provide important functionality but can be difficult to employ and deal with properly, especially in Flows. In this blog post, we will see how we can use a Lightning web component to act as a rich text area.

What is a Rich Text Area Field? 

  • Rich Text is a field type that enables authors to create rich text content.
  • The Rich Text field provides rich formatting options for text entered into its field.
  • The text formatting options are presented in a toolbar which is displayed on top of the field.
  • Rich Text field type is mostly used when users need to apply various formatting options to their data, like changing the font, to enter html, to enter bulleted points and many other such options.
  • This field type accepts all kinds of data, for example, plain text, special characters, numbers.

Limitations, when working with Rich Text Area Fields.

  • Salesforce supports up to 131,072 characters for each rich text area field, including the HTML tags.
  • An object can contain unlimited rich text area and long text area fields, although your edition’s allocation for total custom fields allowed on an object, regardless of field type, applies.
  • Each object can contain 1,638,400 characters across long text area and rich text area fields.
  • When you create a long text area or rich text area field, you set a character limit for the field—the maximum length of the text that can be entered.
  • You can’t paste special characters, such as bullets or curly quotes, into a rich text field from another application. It’s best to type or paste in plain text and use the rich text editor to format it.
  • HTML code isn’t supported in the Salesforce HTML editor. HTML code is treated as text.
  • The character count includes HTML markup that is not visible in the editor. The HTML markup is returned through the API.
  • Depending on how much formatting you apply, the number of characters you can type into the rich text field is fewer than the specified limit. This is because the HTML markup counts against the character limit of a field. For example, bold formatting includes the <b></b> tag around your text and adds up to 7 more characters.
  • Special characters like & are encoded as &amp; which adds up to 5 more characters. Also, the rich text field in Lightning Experience and Salesforce Classic can vary in HTML markup, such as with using RGB or hexadecimal values when color formatting is applied. Paragraph and line breaks also insert the <p></p> and <br> tags, counting against the character limit. See Editing Rich Text Area Fields in Records for information on formatting support.


Steps To Add Text Rich Area Field In Flow?

  • Create a LWC component and name it TextAreaFlow.
  • You will get the complete code from Here.
  • To execute the flow action and for flow support we need to import some actions from the lightning/flowSupport library.


import { FlowAttributeChangeEvent, FlowNavigationNextEvent, FlowNavigationFinishEvent, FlowNavigationBackEvent, FlowNavigationPauseEvent } from ‘lightning/flowSupport’;


Configure Component in Flow

  • Create a flow or edit the flow where you wanted to use the rich text area field.
  • Drag & Drop the LWC inside the Screen element.



Advantage of using Rich Text Area Field

  1. The Rich text field lets you add any kind of static text, image and others.
  2. There are multiple formatting options such as
  • Bold
  • Italics
  • Underline
  • Strikethrough
  • Text color
  • Alignment
  • Headings
  • Hyperlinks
  • Bullets
  • Blockquote
  • Add an image