3

So this is pretty simple to create. I have the code:

showMessage : function(){
    var toastEvent = $A.get("e.force:showToast");
    toastEvent.setParams({
        mode : "dismissable",
        message : "My Message",
        type : "success",
        duration : 1000
    });
    toastEvent.fire();
}

The problem with this, is that the toast message that shows up disappears after 5 seconds when it should disappear after 1 second. The Salesforce documentation states that the duration has a default value of 5000 milliseconds (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_showToast.htm), but it does not let me enter a value lower than this. I am trying to find a workaround, or if anyone knows a way to get this to work. This would be extremely helpful.

(Seems I am not the only one looking for a solution - https://github.com/salesforce-ux/design-system/issues/296)

  • 1
    I believe the minimum value was previously 5,000 ms. This was present in a previous version of the documentation, IIRC, but seems absent in the current version. I think the toast is intended not to have a minimum duration, but maybe they haven't patched it yet. – sfdcfox Feb 27 '18 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.