I need to put a Button in the record Detail View that executes some code through aura componenet.

I've generated a lightning app and put it into a visualforce page that has been set behind the button.

<apex:page showHeader="true" sidebar="true" standardcontroller="Lead">
<apex:includeScript value="/lightning/lightning.out.js" />

<div id="lightning" />

    $Lightning.use("c:ExposeChangeOwnerVF", function() {
      { label : "",
      recordId : '{!Lead.Id}' },
      function(cmp) {


Now I want to refresh the page after the component has done the callback:

 if(state === "SUCCESS"){
            console.log('step 3');


But when I click the button I get this error:

This page has an error. You might just need to refresh it. Error in $A.getCallback() [Cannot read property 'setParams' of undefined] Callback failed: apex://CambioOwner_Controller/ACTION$changeOwnerForSelectedRecord Failing descriptor

It seems that the problem shows up only when I embed the component into the visualforce through the lightning app, but If I use it as a quick action it work without any errors.

Do you have any suggestion?

2 Answers 2


Lightning statndard events like $A.get("e.force:refreshView").fire(); are not supported when lightning component is used in visual force pages.

  • So there is no way to do that? I would like to refresh the detail view after some field update are done! Jul 4, 2017 at 12:29
  • Can you please tell me if what was the need to use the vf page insted of using lightning component directly? Jul 4, 2017 at 12:37
  • I don't want to show the modal that it's open while executing a quick action. Jul 4, 2017 at 12:45
  • Looks like there is not a direct way but what you can do is creating your own refresh method and re-initializing the variables. Jul 4, 2017 at 13:20
  • So far, I've just set the Height of quick action modal to 0% and by using the force:closeQuickAction the user will view the modal only for second! I hope SF will improve this functionality! Jul 4, 2017 at 13:23

In visualforce pages you can use sforce.one methods. So if it suits you you can reload existing page by using sforce.one.navigateToURL(..)

 <apex:outputPanel rendered="{!redirectURL!=''}">            
             <script type="text/javascript">

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .