My Lightning component:
<aura:component controller="MyController" implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global">
<aura:attribute name="recordId" type="Id"/>
...
<button type="button" onclick="{!c.doRun}">Activate Next</button>
</aura:component>
which is embedded into a Standard Layout using Visualforce and Lightning Out
<apex:page standardController="CustomObject__c">
<apex:includeLightning />
<div id="mydiv" />
<script>
$Lightning.use("myApp", function() {
$Lightning.createComponent("myComponent",
{ recordId : "{!CustomObject__c.Id}" },
"mydiv",
function(cmp) {});
});
</script>
</apex:page>
is unable to fire the standard app event $A.get("e.force:refreshView").fire()
({doRun : function(component, event, helper) {
var action = component.get("c.run");
action.setCallback(this, function(response) {
if (component.isValid() && response.getState() === "SUCCESS") {
$A.get("e.force:refreshView").fire();
}
});
$A.enqueueAction(action);
}})
When I click the button this error appears on the screen:
This page has an error. You might just need to refresh it. Error in $A.getCallback() [Cannot read property 'fire' of undefined] Failing descriptor:
DISCLAIMER: I know that this is a duplicate of $A.get('e.force:refreshView').fire() did not refresh the record detail component but this question got lost in irrelevant details and found no solution yet.*