I have a lightning component in a custom lightning record detail page. I want to force refresh on the parent page when the lightning component is loaded. i.e.
I open a record.
Record detail page loads- this is the custom lightning record detail page.
Custom lightning component embedded at the bottom of the page loads.
In the custom lightning embedded component, I have the following piece of code. (within helper)
updateAssignedTo : function(component, event, helper) { var recordId = component.get("v.recordId"); console.log('Record Id&&&&&&****'+recordId); var action = component.get("c.updateAssignedTo"); action.setParams({ accountRequestId : recordId, }); action.setCallback(this, function(response){ var state = response.getState(); if (state === "SUCCESS") { **$A.get('e.force:refreshView').fire();** }else if (state === "ERROR") { } }); $A.enqueueAction(action); },
var action = component.get("c.updateAssignedTo"); is successfully called.
I am trying the refresh the parent page by the following piece of code.
$A.get('e.force:refreshView').fire();
However, it is not happening.
Is this a feasible way to do it?
force:refreshView
event - add to your markup:<aura:handler event="force:refreshView" action="{!c.doInit}" />