Add this code in any Lightning component controller
1. With Event
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
title : 'Error',
message: 'Something went wrong. Please contact System Administrator!',
duration:' 5000',
key: 'info_alt',
type: 'error',
mode: 'sticky'
});
toastEvent.fire();
=========================================================
2. Without fire any event
Use markeup in Component :
<lightning:notificationsLibrary aura:id="notifLib"/>
component.find('notifLib').showToast({
"title": "Error!",
"message": "Please remove the Row, duplicates participates has been found",
"variant" : "error",
"mode": "sticky"
});
Reference: https://www.biswajeetsamal.com/blog/display-toast-message-in-lighting-component/
No comments:
Post a Comment