Development questions
How do you show a toast message in LWC?
DevelopmentEasy
Import ShowToastEvent and dispatch it:
javascript
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
this.dispatchEvent(new ShowToastEvent({
title: 'Success',
message: 'Record saved',
variant: 'success', // info | success | warning | error
mode: 'dismissable' // sticky | pester | dismissable
}));
Toasts work in Lightning Experience and the Salesforce mobile app, and in Experience Cloud sites that support them.
lwctoastui
More Development questions
- What is an Apex Trigger in Salesforce and when should you use it over Flows?
- What is the difference between before triggers and after triggers?
- Explain all Trigger context variables (isInsert, isUpdate, isDelete, isUndelete, isBefore, isAfter, isExecuting, size, operationType).
- What is the difference between Trigger.new and Trigger.old?
- In which trigger events are Trigger.new and Trigger.newMap available?
- In which trigger events are Trigger.old and Trigger.oldMap available?