Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

9

Not an immediate answer, but the long term solution would be to indicate the known issue affects you Lightning Component force:showToast event displays toast message behind action window in Lightning Experience and Salesforce1


6

You can provide an 'action' in the messageTemplateData provided to the showToast event. Here's an example where the link's action becomes creating an event which will trigger a second toast. showToast: function(component, event, helper) { var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ title: "Success!", mode: "...


4

As far as I can tell, you have to literally use templating to get them to appear correctly: ({ init: function(component, event, helper) { $A.get("e.force:showToast") .setParams({title:"Success", message:"hello world", messageTemplate:"{0}hello world{1}", messageTemplateData: ["{...


4

You can't. There's no API available for a developer to alter a toast once it has been dispatched, including closing the toast or altering its behavior. You have three basic options here: show the toast until a duration has elapsed, show the toast until the user dismisses it, or show the toast until the duration has elapsed or the user dismisses it, whichever ...


4

From Salesforce docs: e.force:showToast event is handled by the one.app container. It’s supported in Lightning Experience, Salesforce app, and Lightning communities. It doesn't say anything about classic or VF, so my best guess is You have to manually implement toast using SLDS. Src: https://developer.salesforce.com/docs/component-library/bundle/...


4

Yes, you can get the toast information, as it is an application event, and thus propagates to all interested listeners. Here's the code I wrote that demonstrates this: <aura:component implements="flexipage:availableForAllPageTypes"> Toast Processor <aura:handler name="init" value="{!this}" action="{!c.init}" /> <aura:handler ...


4

You can use the lightning:notificationsLibrary and put a notice up over your modal. It's not the same as a toast, but might work in some cases.


4

var resultsToast = $A.get("e.force:showToast"); resultsToast.setParams({ mode: 'sticky', message: 'This is a required message', messageTemplate: 'Record {0} created! See it {1}!', messageTemplateData: ['Salesforce', { **url: 'https://xx-dev-ed....


3

As of today, it doesn't seem you can use links in toast message in LWC directly. I have created this idea to allow the ability to show links in LWC toasts. In Lighting Aura Components (LAC), the force:showToast had additional attributes for this purpose - messageTemplate and messageTemplateData. But, these attributes are not available for the ...


3

From the description and image ,I see that you are using Lightning components inside the Visualforce page . Having lightning components inside the visualforce ,you will loose certain events as documented in the guide .The events that are not supported are as below 1.force:createRecord 2.force:editRecord 3.force:navigateToList 4.force:navigateToObjectHome ...


1

Are you firing this from the developer console? if that is the case try to do it via an app or lightning quick action. I think that your toastEvent is undefined because you are trying to fire it from the Developer Console. – the solution for this is to fire this component from a app or lightning quick action. You can also drag it to a detail page and verify ...


1

Use e.force:showToast to show toast https://developer.salesforce.com/docs/component-library/bundle/force:showToast/documentation showToast : function(component, event, helper) { var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ "title": "Success!", "message": "The record has been updated successfully." }); ...


1

You can use below code to show Toast Message in VF Page. <apex:page > <apex:slds /> <script> function toastLaunch(){ var element = document.getElementById("ToastMessage"); element.classList.toggle("slds-hidden"); } </script> <div class="demo-only slds-hidden" style="height: 4rem;" id='ToastMessage'> <div class="...


1

No, a toast is an informative message (e.g. an error occurred or something else). It is not a modal dialog with buttons you can configure. You'll notice that there's absolutely no way to know that a toast has even been closed/dismissed, much less know the disposition of that closure. The correct method would be to use the lightning:overlayLibrary (or create ...


1

In your setCallback In your JS controller, use below: samplecall.setCallback(this, function(Callresp) { if (Callresp.getState() === "SUCCESS") { helper.showToast('success', Callresp.getReturnValue() ); } else if (status === "INCOMPLETE") { helper.showToast('error', Callresp.getReturnValue() ); } else ...


1

I created a simple custom ToastError component to get around this limitation. Usage <c:ToastError visible="{!v.showError}" contents="{!v.errorMessage}" /> Implementation: ToastError.cmp <aura:component> <aura:attribute name="visible" type="Boolean" default="false" /> <aura:attribute name="contents" type="String" /> &...


1

I think your issue is similar to this. Known Issue


1

You have a duration attribute in lightning toast method. Once the toast method is fired using. toastEvent.fire(); you can use javascript setTimeout method of the same duration and In that method, you can use javascript to set focus on particular input with particular id like this. document.getElementById("InputId").focus(); or you can use cmp.get("v.Input"...


1

You can accomplish this using jquery to change the css of the toast component. Add this line before your toast $('.forceToastManager').css('white-space', 'pre-wrap'); Then just add \n's wherever you want line breaks in your message. In your case you can replace . with \n and I believe it will work as you want.


Only top voted, non community-wiki answers of a minimum length are eligible