Skip to main content
This complete Inline JavaScript widget lets an operator edit Markdown and inspect a committed preview. Prepare preview commits the draft and refreshes only the preview cell. It does not send or queue a message.

Prerequisites

Create a Custom Widget, select Inline / JavaScript, and keep view execution read-only. No target registry is needed: the form uses REFRESH in its own frame. Leave Inputs as {} to try the example without uploads. If uploads are needed, configure uploadFolderId with an existing folder the viewer may write to.

Source

Expected result

  1. Enter Hello **customer**. in the message field.
  2. Select Prepare preview. The Markdown reader shows the committed message with customer in bold.
  3. Edit the draft again. The prepared result stays unchanged until the next successful submit.
  4. Refresh the widget. The stable reply control retains its draft.
The Markdown reader previews message content. Final email HTML/text and templates belong in your application library; this example does not render a finished email. When an upload folder is configured, file selection, drag/drop or pasting a screenshot uploads a normal Storage attachment. Submission waits until uploads are ready or removed. The preview does not load or send those files; the committed draft retains their identities for a separately authorized writer.

Failure behavior

An invalid draft, excessive text, an inaccessible upload folder or unfinished attachment leaves the preparation incomplete. Review the local error, remove or retry the attachment and submit again. Neither a successful upload nor a preview confirms delivery. For a later sending workflow, register an explicit write action, validate recipients and current Storage access/version on the server, keep internal notes separate, and use its durable delivery/idempotency contract. See message composer, execution and state.
Last modified on November 12, 2026