Search code examples
salesforcesalesforce-service-cloudaura-framework

How to pass variable form aura component to screen flow


Question :

i implemented screen flow to update case object and here i tried to invoke flow from aura component

flow invoking as expected but i want pass case id from aura controller to screen flow

how can we pass variable from aura to flow ?

thank you !


Solution

  • The method startFlow takes two parameters:

    • flowName - Required. The unique name of the flow.
    • inputVariables - Optional. An array of object used to set the initial values for the flow’s input variables.

    In your controller you should have something like this:

    init : function (cmp) {
        var flow = cmp.find("myFlow");
        var inputVariables = [
        {
            name : 'CaseId',
            type : 'String',
            value : cmp.get("v.caseId")
        }
        ];
        flow.startFlow("myFlowName", inputVariables);
    }
    

    You could take a look at flow component documentation.