Installation – Install in Production

Sandbox – Install in a Sandbox

Source Code – Source code repository

Enhanced by Eric Smith – December 2019 (Version 2.0)

Version 1.1 only supported specifying the type of Toast (Info, Success, Error, Warning) and the message.

Version 2.0 adds the ability to include a clickable link in the message, add a title, add a custom icon, control the duration of the toast message and select the display mode (Dismissible, Pester & Sticky).

This local action will pop up a toast message.

IMPORTANT! This action will only work in Flows executing in Lightning pages. It will not work if run from Flow Setup (including the Debugger), even if you are in Lightning Experience mode. It will not work if run in a VF page in Classic. This is due to a limitation of the underlying event. For more information, see this documentation

How It Works

This action uses the force:showToast event

It takes multiple attributes. You can control the message, display type and mode, duration and even include a clickable link in the message.

Using the Component

You can use this Lightning Component in a Flow to configure and display a Toast message.

Parameters

(Required)

  • Type – Success (default), Warning, Error, Info & Other
    • Other is styled like Info but is displayed without an Icon unless you specify a custom icon to use.
  • Message – The message to display in the toast
    • To include a clickable link in the message, place the characters {url} in your message and provide values for the URL Link and URL Label parameters.

(Optional)

  • Title – Text to appear above the message in a slightly larger font
  • Icon – The name of the Utility icon to display when choosing a Type of Other
  • Mode – Dismissible (default), Pester & Sticky
    • Dismissible will display the toast message until the close button is clicked or the duration time has elapsed.
    • Pester will display until the duration time has elapsed. No close button will be available.
    • Sticky will remain displayed until the close button is pressed
  • Duration – The default is 10 seconds and the minimum is 5 seconds.
    • The duration attribute only applies to Dismissible and Pester modes
  • URL Label – This is the Label for the link in your message
    • To include a clickable link in the message, place the characters {url} in your message. At run-time the message will be updated to replace {url} with the value of your URL Label parameter and it will link to the address you specified in the URL Link parameter.
  • URL Link – This is the URL for the link in your message

Sample Usage

This first example shows how a Toast Message can be activated with just a message and defaults.



This example generates a Warning message with a Title, 15 second duration and no close button.


This example generates a Toast Message with a Custom Icon and will be displayed until the close button is clicked.


This last example includes a Link to a newly created record from the Flow.

{!vContactId} holds the record ID of the new Contact
In the message, {url} will be replaced with a Link defined by URL Label and URL Link
This is the URL Label
This is the URL Link

fContactRecordURL is a special formula you can use to combine the correct URL with the currently running domain name and the recordId you want to display.

LEFT({!$Api.Partner_Server_URL_340},FIND("/services", {!$Api.Partner_Server_URL_340})) & {!vContactId} 

Resources

Want to suggest an improvement or report a bug? Do that here

Learn more about how Flow Components work

Know a little javascript and want to add some improvements? {Pull requests are welcome}(/pulls) If you’re thinking of adding much complexity to the user interface, though, you probably should fork the repo, because we want to keep this baseline version easy-to-use.