Alert component

For simple notifications about a customer’s status or urgent situations that require immediate visibility, especially when opening a record, having a clear and consistent way to inform users becomes essential. This Alert Component is a practical and versatile Lightning Web Component designed to enhance user notifications within your Salesforce environment. It supports different display methods, such as popups and banners, as well as multiple alert types including warning, error, and info, making it suitable for a wide range of use cases.

HACKS

jmelon

6/22/20242 min read

it's a Lightning Web Component (LWC) designed to notify users about the status of records within Salesforce.

To use the component, upload it to your Salesforce organization and place it on the desired Lightning page. The code is alsoavailable at https://github.com/mpdigitals/alert-component-sfdc.

Configure the properties to customize the alert behavior and appearance.

Configure the component visibility to filter when the message should be shown. This can be done through the Lightning App Builder by setting visibility rules based on criteria such as user profile, record fields, or other conditions.

Configuration
Options

1. Type:

  • Popup: Displays the alert as a popup message.

  • Banner: Displays the alert as a banner at any place of the page.

2. Display PopUp Method:

  • Alert: Shows the alert using the LightningAlert component.

  • Toast: Shows the alert as a toast message using the ShowToastEvent.

3. Alert Type:

  • Warning: Indicates a warning that needs user attention.

  • Error: Displays an error message.

  • Info: Provides informational messages.

4. Alert Title: The title of the alert message.

5. Message: The main content of the alert message.

Types
SLDS alert banner
toast
ligthning-alert
Code

Related Stories

Related Stories