Guest User

Untitled

a guest
Feb 26th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. <apex:page standardController="Account" >
  2. <flow:interview name="Accountdeal" finishLocation="/{!Account.Id}">
  3. <apex:param name="inputAccount" value="{!Account}"/>
  4. **For Lightining for refreshing,i have embed this code in Visual Force page**
  5. <html>
  6. <head>
  7. <apex:includeLightning />
  8. </head>
  9. <body class="slds-scope">
  10. <div id="flowContainer" />
  11.  
  12. <script>
  13. $Lightning.use("c:Refreshingthepage", function() {
  14. $Lightning.createComponent("lightning:flow", {"onstatuschange":handleStatusChange}
  15.  
  16. )
  17. ;}
  18. );
  19. var handleStatusChange = function (component,event) {
  20. console.log("fxn fired");
  21. if(event.getParam("status") === "FINISHED") {
  22. console.log("flow finished");
  23. var outputVariables = event.getParam("outputVariables");
  24. var outputVar;
  25. for(outputVar in outputVariables) {
  26. if(outputVariables[outputVar].name === "redirect") {
  27. console.log("redirect found");
  28. window.parent.location = '/' + outputVariables[outputVar].value;
  29. $A.get('e.force:refreshView').fire();
  30.  
  31. }
  32.  
  33. }
  34. }
  35. };
  36.  
  37. </script>
  38.  
  39.  
  40.  
  41. </body>
  42. </html>
  43.  
  44. <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
  45. <aura:handler name="init" value="{!this}" action="{!c.init}"/>
  46. <aura:handler event="force:refreshView" action="{!c.handleStatusChange}"/>
  47. <lightning:flow aura:id="flowdata" onstatuschange="{!c.handleStatusChange}"/>
  48. </aura:component>
  49.  
  50. ({
  51. init:function(component){
  52. var flow = component.find("flowData");
  53. var inputvariables = [
  54. {
  55. name:"inputAccount",
  56. type:"Sobject",
  57. value:component.get("v.recordid")
  58. }
  59. ];
  60. flow.startflow("Flow name",inputvariables);
  61. },
  62. handleStatusChange : function(component, event) {
  63. if(event.getParam("status") === "FINISHED") {
  64. var outputVariables = component.get("v.recordid");
  65. var urlEvent = $A.get("e.force:navigateToSObject");
  66. urlEvent.setParams({
  67. "recordId": outputVariables,
  68. "isredirect": "true"
  69. });
  70. urlEvent.fire();
  71. console.log(urlEvent);
  72. $A.get('e.force:refreshView').fire();
  73. $A.enqueueAction(init);
  74. $A.enqueueAction(handleStatusChange);
  75.  
  76. }
  77. }
  78. })
Add Comment
Please, Sign In to add comment