4

One of SObject Lightning pages contains an Action Button which opens a custom Visualforce page. How can I close it in other way than clicking the 'X' button?

So far I've tried:

window.close(), window.top.close(), window.self.clse(), $A.get("e.force:closeQuickAction").fire(); and window.top.location.href="/{!$CurrentPage.parameters.id}" - none of these worked.

So far, an option closest to the solution was usage of window.top.location.href="/{!$CurrentPage.parameters.id}" but it refreshes the whole window.

I was hoping the $A.get("e.force:closeQuickAction").fire(); line will do the trick, but I'm receiving $A is nod defined error, even if I use <apex:useLightning/> tag.

8

I've eventually found a solution. The following script has to be included:

<script type='text/javascript' src='/canvas/sdk/js/publisher.js'></script>

Then use this line to close the Quick Action window:

Sfdc.canvas.publisher.publish({ name: "publisher.close", payload:{ refresh: "true" }});

  • Awesome!! Why is this so poorly documented!? – jordan.baucke Sep 3 at 18:50
  • 1
    Well, looks kinda like a hack so I can understand why they didn't included it explicitly anywhere in the documentation. – notmyf4ulty Sep 9 at 8:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.