Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Sunil02kumar/e0ae624fab073db19569a2c6e3928625 to your computer and use it in GitHub Desktop.
Save Sunil02kumar/e0ae624fab073db19569a2c6e3928625 to your computer and use it in GitHub Desktop.
Lightning:NotificationsLibrary : Easy Way to Display Notices in Lightning
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
<lightning:notificationsLibrary aura:id="notifLib"/>
<lightning:button name="notice" label="Display Notice" onclick="{!c.showNotice}"/>
</aura:component>
({
//available variant values are info, warning, and error. This value defaults to info.
showNotice : function(component, event, helper) {
component.find('notifLib').showNotice({
"variant": "error",
"header": "An Internal Server has occured!",
"message": "There was a problem updating the record. Please contact your system administrator.",
closeCallback: function() {
$A.get('e.force:refreshView').fire();
}
});
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment