Skip to main content
added 245 characters in body
Source Link
Kris Goncalves
  • 22.8k
  • 8
  • 35
  • 72

Looking at the Documentation:

When prefixing the toast with an alert(),: the alert is showshown, as is a console.log() after the toast, so (so the toast is fired without errors), but no toast message is shown.

handleButtonClick() { 
  callApexController({ // }) 
  .then( result => { 
    console.log('Button Clicked'); // shows in console 
    const evt = new ShowToastEvent({ 
      title: 'Toasty Title', 
      message: 'My message', 
      variant: 'success', 
      mode: 'sticky' }); 
    this.dispatchEvent(evt); // never happens 
    alert('Boom!'); //shows 
  }) 
 .catch( error => { 
    console.log('Something went wrong'); 
    console.error(error); // logs to console correctly 
    const evt = new ShowToastEvent({ 
      title: 'Toasty Error Title', 
      message: 'My Error Message', 
      variant: 'sticky', 
    }); 
    this.dispatchEvent(evt); // never happens 
  }); 
  alert('Boom'); // alert shows 
} 
 handleButtonClick() { 
   callApexController({ // }) 
   .then( result => { 
     console.log('Button Clicked'); // shows in console 
     const evt = new ShowToastEvent({ 
       title: 'Toasty Title', 
       message: 'My message', 
       variant: 'success', 
       mode: 'sticky' }); 
     this.dispatchEvent(evt); // never happens 
     alert('Boom!'); //shows 
   }) 
  .catch( error => { 
     console.log('Something went wrong'); 
     console.error(error); // logs to console correctly 
     const evt = new ShowToastEvent({ 
       title: 'Toasty Error Title', 
       message: 'My Error Message', 
       variant: 'sticky', 
     }); 
     this.dispatchEvent(evt); // never happens 
   }); 
   alert('Boom'); // alert shows 
 } 

No Toast shown in Digital Experience. Other alerts are shown.

https://developer.salesforce.com/docs/component-library/bundle/lightning-platform-show-toast-event/documentation -> no mention of toast not working

https://developer.salesforce.com/docs/atlas.en-us.bi_dev_guide_lwc_in_db.meta/bi_dev_guide_lwc_in_db/bi_lwc_in_db_overview.htm -> no mention of toast not working

When prefixing the toast with an alert(), the alert is show, as is a console.log() after the toast, so the toast is fired without errors, but no toast message is shown.

handleButtonClick() { 
  callApexController({ // }) 
  .then( result => { 
    console.log('Button Clicked'); // shows in console 
    const evt = new ShowToastEvent({ 
      title: 'Toasty Title', 
      message: 'My message', 
      variant: 'success', 
      mode: 'sticky' }); 
    this.dispatchEvent(evt); // never happens 
    alert('Boom!'); //shows 
  }) 
 .catch( error => { 
    console.log('Something went wrong'); 
    console.error(error); // logs to console correctly 
    const evt = new ShowToastEvent({ 
      title: 'Toasty Error Title', 
      message: 'My Error Message', 
      variant: 'sticky', 
    }); 
    this.dispatchEvent(evt); // never happens 
  }); 
  alert('Boom'); // alert shows 
} 

No Toast shown in Digital Experience. Other alerts are shown.

https://developer.salesforce.com/docs/component-library/bundle/lightning-platform-show-toast-event/documentation -> no mention of toast not working

https://developer.salesforce.com/docs/atlas.en-us.bi_dev_guide_lwc_in_db.meta/bi_dev_guide_lwc_in_db/bi_lwc_in_db_overview.htm -> no mention of toast not working

Looking at the Documentation:

When prefixing the toast with an alert(): the alert is shown, as is a console.log() after the toast (so the toast is fired without errors), but no toast message is shown.

 handleButtonClick() { 
   callApexController({ // }) 
   .then( result => { 
     console.log('Button Clicked'); // shows in console 
     const evt = new ShowToastEvent({ 
       title: 'Toasty Title', 
       message: 'My message', 
       variant: 'success', 
       mode: 'sticky' }); 
     this.dispatchEvent(evt); // never happens 
     alert('Boom!'); //shows 
   }) 
  .catch( error => { 
     console.log('Something went wrong'); 
     console.error(error); // logs to console correctly 
     const evt = new ShowToastEvent({ 
       title: 'Toasty Error Title', 
       message: 'My Error Message', 
       variant: 'sticky', 
     }); 
     this.dispatchEvent(evt); // never happens 
   }); 
   alert('Boom'); // alert shows 
 } 

No Toast shown in Digital Experience. Other alerts are shown.

Source Link
xouns
  • 145
  • 10

Lightning Toast Message in Tableau CRM LWC Components

We created a LWC to aid our users when navigating Tableau CRM Dashboards hosted in a Digital Experience Site. When users press a button, I want to show the user a toast message. However, this message is never shown.

When prefixing the toast with an alert(), the alert is show, as is a console.log() after the toast, so the toast is fired without errors, but no toast message is shown.

What could be the reason for this?

Controller class:

handleButtonClick() { 
  callApexController({ // }) 
  .then( result => { 
    console.log('Button Clicked'); // shows in console 
    const evt = new ShowToastEvent({ 
      title: 'Toasty Title', 
      message: 'My message', 
      variant: 'success', 
      mode: 'sticky' }); 
    this.dispatchEvent(evt); // never happens 
    alert('Boom!'); //shows 
  }) 
 .catch( error => { 
    console.log('Something went wrong'); 
    console.error(error); // logs to console correctly 
    const evt = new ShowToastEvent({ 
      title: 'Toasty Error Title', 
      message: 'My Error Message', 
      variant: 'sticky', 
    }); 
    this.dispatchEvent(evt); // never happens 
  }); 
  alert('Boom'); // alert shows 
} 

From the code you can see that first I write to console, then I want to show a sticky toast that will not go away unless I click it (so I'm not to late during testing), and then I show an alert box. The first and the last actions are all executed, however the middle part that fires the toast does not.

This is observed in Tableau CRM dashboards viewed in Tableau itself, as well as TCRM Dashboards hosted in Digital experience cases (see screenshot). It looks like Toast messages are not implemented in Tableau CRM Dashboard Components, but I cannot find any mention of this in the documentation so it appears like it should work. Am I doing anything wrong?

No Toast shown in Tableau Dashboard Viewer. Other alerts are shown.

No Toast shown in Digital Experience. Other alerts are shown.

https://developer.salesforce.com/docs/component-library/bundle/lightning-platform-show-toast-event/documentation -> no mention of toast not working

https://developer.salesforce.com/docs/atlas.en-us.bi_dev_guide_lwc_in_db.meta/bi_dev_guide_lwc_in_db/bi_lwc_in_db_overview.htm -> no mention of toast not working