Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <apex:page standardController="Account" >
- <flow:interview name="Accountdeal" finishLocation="/{!Account.Id}">
- <apex:param name="inputAccount" value="{!Account}"/>
- **For Lightining for refreshing,i have embed this code in Visual Force page**
- <html>
- <head>
- <apex:includeLightning />
- </head>
- <body class="slds-scope">
- <div id="flowContainer" />
- <script>
- $Lightning.use("c:Refreshingthepage", function() {
- $Lightning.createComponent("lightning:flow", {"onstatuschange":handleStatusChange}
- )
- ;}
- );
- var handleStatusChange = function (component,event) {
- console.log("fxn fired");
- if(event.getParam("status") === "FINISHED") {
- console.log("flow finished");
- var outputVariables = event.getParam("outputVariables");
- var outputVar;
- for(outputVar in outputVariables) {
- if(outputVariables[outputVar].name === "redirect") {
- console.log("redirect found");
- window.parent.location = '/' + outputVariables[outputVar].value;
- $A.get('e.force:refreshView').fire();
- }
- }
- }
- };
- </script>
- </body>
- </html>
- <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
- <aura:handler name="init" value="{!this}" action="{!c.init}"/>
- <aura:handler event="force:refreshView" action="{!c.handleStatusChange}"/>
- <lightning:flow aura:id="flowdata" onstatuschange="{!c.handleStatusChange}"/>
- </aura:component>
- ({
- init:function(component){
- var flow = component.find("flowData");
- var inputvariables = [
- {
- name:"inputAccount",
- type:"Sobject",
- value:component.get("v.recordid")
- }
- ];
- flow.startflow("Flow name",inputvariables);
- },
- handleStatusChange : function(component, event) {
- if(event.getParam("status") === "FINISHED") {
- var outputVariables = component.get("v.recordid");
- var urlEvent = $A.get("e.force:navigateToSObject");
- urlEvent.setParams({
- "recordId": outputVariables,
- "isredirect": "true"
- });
- urlEvent.fire();
- console.log(urlEvent);
- $A.get('e.force:refreshView').fire();
- $A.enqueueAction(init);
- $A.enqueueAction(handleStatusChange);
- }
- }
- })
Add Comment
Please, Sign In to add comment