Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SalesforceBobLightning/39940e85a30adb65aabb19632294e2da to your computer and use it in GitHub Desktop.
Save SalesforceBobLightning/39940e85a30adb65aabb19632294e2da to your computer and use it in GitHub Desktop.
Salesforce Lightning Show Toast JavaScript Helper Method
// Documentation: https://developer.salesforce.com/docs/component-library/bundle/force:showToast/specification
// type: 'error', 'warning', 'success', or 'info'
showToast : function(title, message, type, icon) {
var toastEvent = $A.get("e.force:showToast");
toastEvent.setParams({
title : title,
message: message,
duration: '2000',
key: icon,
type: type,
mode: 'dismissible'
});
toastEvent.fire();
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment