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}
Best Answer
For this case the user profile must have the Run Flows enable.
Hope this helps.
JCH