I am trying to launch a flow from an aura component. In the flow, I have an apex variable of type "Apex-Defined Collection variable". How to set the value of this variable from the aura component? I have two other string variables in the flow, I am able to set them, but when I set the value in the apex defined var, the flow fails to launch. Below is the relevant code from the aura component:

const flow = component.find("flowData");
const inputVariables = [
            name: "varCaseId",
            type: "String",
            value: component.get("v.recordId")
            name: "varAccountNumber",
            type: "String",
            value: response.accountNumber
            name: "varIntents",
            type: "Intent",
            value: response.intents
flow.startFlow(response.flowAPIName, inputVariables);

If I remove the third element from the inputVariables array, then the flow launches correctly, otherwise not. Any idea what am I doing wrong here?

2 Answers 2


If the flow launches correctly when you remove the third element, varIntents, then I'd suggest you check the flow variables to ensure 'varIntents' is configured in the same manner as varCaseId and varAccountNumber. The varIntents variable may not be configured as an input variable within your flow.

  • hi Robert, thanks for your reply. The 'varIntent' variable is configured as an input variable. The only difference is that the data type of varCaseId and varAccountNumber is Text in the flow, whereas the data type of varIntents is "Apex-Defined Collection Variable". I am not sure if this is the correct way to set value of an Apex-Defined Collection Variable. I am not able to find any example in the Salesforce documentation also. Also, I am not sure whether its allowed to set the value of an Apex-Defined Collection Variable from outside the flow. Sep 14, 2020 at 17:11
  • help.salesforce.com/… - Please check the point mentioned under the subheading "Input and Output Variables". Does that mean that we cannot set the value of an Apex-Defined Collection Variable from an aura component? Sep 14, 2020 at 17:12
  • Yes, that appears to be the case. An Apex defined variable cannot be set/stored outside of a Flow. Sep 14, 2020 at 21:05

For anyone else who comes across this thread, it is possible to pass apex-defined data types from Aura JS down to the Flow you're starting. Schema:

 name: 'inputVariableName', //name of your input variable
 type: 'Apex', //exactly this value, 'Apex' with capital A
 value: {} //object matching schema of your apex-defined data type

You have to build/get the 'value' object in JS somehow. I figured this out when I was trying to capture apex-defined outputVariables from one flow in my aura component and pass them to identical apex-defined inputVariables in another flow in my aura component. FWIW, outputVariables and inputVariables do not have the same properties, nor does their "data type" enum share the same values. Transforming an output into an input is simple enough, though:

transformOutputVariableToInputParameter: function(outputVariable){
        return {
            name: outputVariable.name,
            type: this.outputInputDataTypeMap[outputVariable.dataType],
            value: outputVariable.value
    outputInputDataTypeMap: {
        STRING: 'String',
        NUMBER: 'Number',
        APEX: 'Apex'
        /* todo: identify specific names of other data types (boolean, sobject, etc.) */

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .