Skip to content

Component Name: toastInLightningFlow

Last Updated: 2025-09-29 Source Code: https://bitbucket.org/i2cinc/i2c.salesforce.metadata/src/STAGING/force-app/main/default/lwc/toastInLightningFlow

API Name: c-toastInLightningFlow Type: Utility Component Target: Not exposed (used in Flows)

Business Purpose

Displays a toast notification within a Lightning Flow and immediately finishes the Flow screen. Allows Flows to show success/error messages without requiring a Flow screen, improving user experience by avoiding unnecessary clicks.

User Interface

No visible UI - shows toast then immediately navigates away

Component Structure

Files

  • toastInLightningFlow.html - Empty template
  • toastInLightningFlow.js - Controller (30 lines)
  • toastInLightningFlow.js-meta.xml - Flow target configuration

JavaScript Controller

Properties (API)

@api mode

  • Type: String
  • Description: Toast mode ("dismissable", "pester", "sticky")

@api variant

  • Type: String
  • Description: Toast variant ("info", "success", "warning", "error")

@api message

  • Type: String
  • Description: Toast message text

@api title

  • Type: String
  • Description: Toast title

Lifecycle

connectedCallback()

  • Calls handleShowToast()
  • Calls handoverCloseAction()

Private Methods

handleShowToast()

  • Creates ShowToastEvent with provided properties
  • Dispatches toast

handoverCloseAction()

  • Creates FlowNavigationFinishEvent
  • Dispatches event to finish Flow

Dependencies

Lightning Platform

  • lightning/platformShowToastEvent: ShowToastEvent
  • lightning/flowSupport: FlowNavigationFinishEvent

Configuration

Exposed to Flows via js-meta.xml configuration

Usage Examples

In Flow Builder

  1. Add Screen element
  2. Add toastInLightningFlow component
  3. Configure:
  4. Title: "Success"
  5. Message: "Record saved successfully"
  6. Variant: "success"
  7. Mode: "dismissable"
  8. Component automatically shows toast and closes screen

⚠️ Pre-Go-Live Concerns

HIGH

  • No unit tests: Zero coverage
  • No delay: Toast shows and Flow immediately finishes - user may not see toast
  • No validation: No validation of required properties

MEDIUM

  • Auto-finish may be unexpected: Users might want to see result before continuing
  • No configuration for finish behavior: Always finishes, no option to stay

LOW

  • Missing property descriptions: js-meta.xml should have property descriptions for Flow Builder

Maintenance Notes

Complexity: Low Key Notes: - Used exclusively in Flows, not standalone pages - Immediately finishes Flow after showing toast - consider adding delay - Toast mode/variant must be valid values (no validation) - Component has no error handling

Browser Compatibility: - Same as Lightning toast/Flow support