0

We are using a backgroundutilityitem component, where we fire a toast event - https://developer.salesforce.com/docs/component-library/bundle/force:showToast/documentation

I know it shows the toast, and it will hide it based on "mode" of the toast. But is there a way we can fire an event to close the toast?

For example, some field changes, we fire the event to close the toast.

Overall summary of what i am building is here - Show pop-up or toast or banner in Lightning Service cloud console

But to summarize, whenever a call comes in omni channel, we show a toast "A call is waiting for you" in lightning service cloud console. I am done with this. Mode of the toast is "sticky", so it will stay there until agent manually closes it.

We also want the functionality where if agent accepts the call or if call gets declined (i can capture both events in my backgroundutilityitem), i want to close the toast (if its displayed).

Since this is a backgroundutilityitem component, putting a custom component (toast or a modal) in it will not display on UI. So we are stuck with using standard force:showToast event (to best of my knowledge).

0

No, there's no way to close the standard toast once you've popped it up. Both lightning:notificationsLibrary and force:showToast only have functionality for opening the toast. You'll have to write your own custom component.

  • I used a custom component and put it in my lightningbackgrounditem component. Any UI component i put in lightningbackgrounditem, doesn't show up. But thanks for your responses. They helped – user2957592 Mar 15 at 0:24

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.