1

I try to start a Flow in Visualforce Page. This Flow has Apex-Defined type input variables.

My Apex-Defined Class code

public class OpportunityCloseConfig {

@AuraEnabled
public String currentType;

@AuraEnabled
public String avoidStage;    
    
}

My code for start flow

    $Lightning.use("c:LightningFlowApp", function() { 
       $Lightning.createComponent("lightning:flow", {"onstatuschange":handleFlowStatusChange},
          "flow-modal-content",
          function (component) {
              var flowName = flow.ApiName;                        
              var namespace = flow.NamespacePrefix;
              var apexObject = {
                  currentType: "Existing Customer - Downgrade",
                  avoidStage: "Closed Won"
              };
              var jsonString = JSON.stringify(apexObject);
              var inputVariables = [
                  {
                    config: apexObject
                  }
              ];                      
              component.startFlow(flowName, inputVariables);
          }
       );                   
    });

When I start flow I got follow error message on Screen, please see this image.

enter image description here

In Browser Console I also found error message "Error in $A.getCallback() [[object Object]]", does anyone know what's wrong in our code and how to fixed it?

0

You can start the flow from Visualforce page by using the below sample code -

<apex:page standardController="Contact">  
   <flow:interview name="<NAME OF YOUR FLOW>" finishLocation="{!URLFOR('/003')}">  
     <apex:param name="currentType" value="Existing Customer - Downgrade" />  
     <apex:param name="avoidStage" value="Closed Won" />  
   </flow:interview>  
 </apex:page> 

You can replace with the actual flow api name.

1
  • Thanks for your idea, after discuss with my team, we decide call this a limitation.
    – GhostLee
    Jan 22 at 8:20

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.