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 templatetoastInLightningFlow.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: ShowToastEventlightning/flowSupport: FlowNavigationFinishEvent
Configuration¶
Exposed to Flows via js-meta.xml configuration
Usage Examples¶
In Flow Builder¶
- Add Screen element
- Add toastInLightningFlow component
- Configure:
- Title: "Success"
- Message: "Record saved successfully"
- Variant: "success"
- Mode: "dismissable"
- 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