You need to sign in to do that
Don't have an account?
Anupama@28
Lightning toastEvent firing twice - how to avoid ?
Hi,
We have a lighting component opens through quick action popup. After finishing the task we are refreshing the record detail page, closing the popup and showing the toast message but the toast message is firing twice. how to avoid this ? We just need one notification message.
Here is my function from helper js.
Thanks,
Anupama
We have a lighting component opens through quick action popup. After finishing the task we are refreshing the record detail page, closing the popup and showing the toast message but the toast message is firing twice. how to avoid this ? We just need one notification message.
Here is my function from helper js.
updateRS : function(component,event) { event.preventDefault(); var currentOpptyId = component.get("v.recordId"); console.log("currentOpptyId : " +currentOpptyId);; var pushmonth = component.get("v.PushMonth"); console.log("pushmonth : " +pushmonth); var action = component.get("c.pushrs"); action.setParams({ "currentOpptyId":currentOpptyId, "pushmonth" : pushmonth }); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS"){ var toastEvent = $A.get("e.force:showToast"); $A.get('e.force:refreshView').fire(); toastEvent.setParams({ "title": "Success!", "message": "Success!", type: 'success', // mode: 'pester' }); toastEvent.fire(); $A.get('e.force:closeQuickAction').fire(); } else{ alert('Pushing Revenue Schedule Period is not successful'); } }); $A.enqueueAction(action); }, closeactionhelper : function(component,event) { setTimeout(function(){ var action = $A.get("e.force:closeQuickAction").fire(); }, 1000); }
Thanks,
Anupama
Can you please post your code here.
Why is there a need to use closeactionhelper when you are already closing the quick action in updateRS ($A.get('e.force:closeQuickAction').fire();)?
Here's my code it works just fine :-
doInit : function(component, event, helper) {
var action = component.get("c.getAccount");
action.setCallback(this,function(response){
if(response.getState() == 'SUCCESS') {
var toastEvent = $A.get("e.force:showToast");
$A.get('e.force:refreshView').fire();
toastEvent.setParams({
"title": "Success!",
"message": "Success!",
type: 'success',
// mode: 'pester'
});
toastEvent.fire();
$A.get('e.force:closeQuickAction').fire();
}
});
$A.enqueueAction(action);
}