"Do you know if I can automatically close a Quick Action popup window after triggering an action that does not require a UI (like downloading something from a Visualforce page)?"
The flow was simple as he asked me: click on a quick action on a standard layout page (with Lightning Experience enabled), trigger something (that can be a call to a Visualforce page or simply a backend elaboration from Apex) and close automatically the popup.
This is the solution: in this case the setTimeout() call was necessary because you need to get a bit "asynchronous", but if you make an Apex controller callback, you don't need it.
Thanks to Salesforce Lightning framework it is easy as it seem:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component implements="force:lightningQuickAction,force:hasRecordId"> | |
<aura:handler name="init" value="{!this}" action="{!c.doInit}" /> | |
Loading data, please wait. . . | |
</aura:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
doInit : function(component, event, helper) { | |
window.location.href="/apex/backgroundPage?id="+component.get("v.recordId"); | |
setTimeout(function(){ | |
$A.get("e.force:closeQuickAction").fire(); | |
}, 1000); | |
} | |
}) |
No comments:
Post a Comment