---
schema_version: "1"
id: 635435af5d628ab19ddf9a7e23ef1146128e4c775d52a934865fd838c5a36ced
title: Reference Flow Output Variable Values in a Wrapper Aura Component
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/components/components-using-flow-inputs-get.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/components-using-flow-inputs-get.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b26aab86211e0ef7863b0bfb12e0e361eaa484d404695adc7e411c5e04d60b89
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# Reference Flow Output Variable Values in a Wrapper Aura Component

When you embed a flow in an Aura component, you can display or reference the flow’s variable values. Use the `onstatuschange` action to get values from the flow's output variables. Output variables are returned as an array.

**note:** The variable must allow output access. If you reference a variable that doesn’t allow output access, attempts to get the variable are ignored.

This example uses the JavaScript controller to pass the flow's accountName and numberOfEmployees variables into attributes on the component. Then, the component displays those values in output components.

```nolang
<aura:component>
   <aura:attribute name="accountName" type="String" />
   <aura:attribute name="numberOfEmployees" type="Decimal" />

   <p><lightning:formattedText value="{!v.accountName}" /></p>
   <p><lightning:formattedNumber style="decimal" value="{!v.numberOfEmployees}" /></p>

   <aura:handler name="init" value="{!this}" action="{!c.init}"/>
   <lightning:flow aura:id="flowData" onstatuschange="{!c.handleStatusChange}" />
</aura:component>
```

```javascript
({
  init: function (component) {
    // Find the component whose aura:id is "flowData"
    var flow = component.find("flowData");
    // In that component, start your flow. Reference the flow's API Name.
    flow.startFlow("myFlow");
  },

  handleStatusChange: function (component, event) {
    if (event.getParam("status") === "FINISHED") {
      // Get the output variables and iterate over them
      var outputVariables = event.getParam("outputVariables");
      var outputVar;
      for (var i = 0; i < outputVariables.length; i++) {
        outputVar = outputVariables[i];
        // Pass the values to the component's attributes
        if (outputVar.name === "accountName") {
          component.set("v.accountName", outputVar.value);
        } else {
          component.set("v.numberOfEmployees", outputVar.value);
        }
      }
    }
  },
});
```

**See Also**

- [_Component Library_: lightning:flow Component](https://developer.salesforce.com/docs/component-library/bundle/lightning:flow/documentation)
