1

I have a aura component with in the opportunity detail page and i'm trying to display toast/ alert message with in the component.Is there any way to display toast/alert message with in the component instead of detail page.

$A.get('e.force:showToast').setParams
({
  "title": "Success",
   "message": "SKU has been deleted successfully!",
   "type": "success",
}).fire();

For Reference: enter image description here

enter image description here

Is there any way to achieve this?

2 Answers 2

0

Not possible without a custom implementation AFAIK.

force:showToast event is (refer to documentation here)

  1. used to display page-level toasts
  2. used to display a message below the header at the top of a view
  3. handled by the one.app container.

AFAIK, it isn't built at platform level to make it localized to individual custom components. You might have to build your own custom implementation display local error message within the component.

0

That is the default behavior of force:showToast, it will displays a message below the header at the top of a view.

If you want to show message on component itself , i would suggest to use ui:message , which will show the message in below format on aura component. enter image description here Note : This tag is only available for Aura component not for LWC.

1
  • Please note ui:message is deprecated as of API version 47.0 and the recommended approach is to migrate to LWC and use the lightning/platformShowToastEvent module (which is nothing but toast message).
    – arut
    Commented Jul 19, 2022 at 13:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .