0

I have written the code for flow Finish Behavior in salesforce,which is embeded in Visual Force Page

<apex:page standardController="objectname" >
   <html>
      <head>
         <apex:includeLightning />
      </head>
      <body class="slds-scope">
         <div id="flowContainer" />


         <script>

            var statusChange = function (event) {
               if(event.getParam("status") === "FINISHED") {
                  var outputVariables = event.getParam("inputAccount");


                 var urlEvent = $A.get("e.force:navigateToSObject");
                urlEvent.setParams({
               "recordId":inputidtest,
               "isredirect": "true"
            });
             urlEvent.fire();
               }
            };
            $Lightning.use("c:lightningOutApp", function() {
               $Lightning.createComponent("lightning:flow", {},
                  "flowContainer",
                  function (component) {
                  var inputVariables = [
                        {
                           name : 'inputidtest',
                           type : 'Input and Output',
                           value : ''
                        }
                     ];

                     component.startFlow("Flow Name");

                  }
               );
            });
         </script>

      </body>
   </html>
</apex:page>

Lightining App Component:

<aura:application extends="ltng:outApp" >
    <aura:dependency resource="lightning:flow"/>

</aura:application>

After Passing Input Varaibles

var inputVariables = [
                        {
                           name : 'inputAccount',
                           type : 'sObject',
                           value : '{!Account}'
                        }

                     component.startFlow("Flow Name",inputVariables);

Error Occured:This page has an error. You might just need to refresh it. Error in $A.getCallback() [[object Object]] Callback failed: serviceComponent://ui.interaction.runtime.components.controllers.FlowRuntimeController/ACTION$runInterview Failing descriptor: {flowruntime:flowRuntime}

4
  • Did you check if your flow needs "subjectNameOrId" parameter? I think you are not passing any parameter. – user36778 Mar 6 '18 at 11:42
  • How to pass parameter @user36778,can you please help me – SFDC Mar 6 '18 at 11:46
  • You are already passing value for inputidtest. Just use similar approach for subjectNameOrId – Tushar Sharma Mar 6 '18 at 11:56
  • ,after passing input Variables and the screen getting error like this@TusharSharma – SFDC Mar 6 '18 at 12:09
2

For this case the user profile must have the Run Flows enable.

Hope this helps.

JCH

1

You can pass an array of objects that contain information about name, type and value of variables that you want to pass to the flow. You can pass this array to startFlow method after the name of flow.

I can see that you already have defined a variable named inputVariables. You just need to update it with right information and then pass as follows

// just fill in right details for type and value
var inputVariables = [
    {
        name: 'subjectNameOrId',
        type: '',
        value: ''
    }
];
// pass variables
component.startFlow("Flow Name", inputVariables);

For more details, checkout this link.

Hope this helps.

4
  • ,after passing input Variables and the screen getting error like this@jagmohan – SFDC Mar 6 '18 at 12:08
  • @SFDCdeveloper Looks like you are not using correct value for type attribute. Please refer this link for more details on type of variable. – jagmohan Mar 6 '18 at 12:19
  • ,after using correct value also it is showing same error,please see my latest updated type in Qusetion @jagmohan – SFDC Mar 6 '18 at 12:23
  • avoid asking follow up questions to your original problem through the comments, instead, open new posts stating what you have tried to resolve the issue and any new issues. – glls Mar 6 '18 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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