---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, Presentation Components, widgets, tags, UI components]
nav: wcp_docs
parent_url: /wcp_docs/
title: outboundVariable
layout: subsection
wd_wcptag: outboundVariable
---

<a id="section_N10021_N1001E_N10001"></a>
Contains variables that other pages can reference. Use `outboundVariable` only on edit pages.

Jump to:

-   [Mobile Support](/wcp_docs/lmd1529983805787.html#section-mobile-support)
-   [Attributes](/wcp_docs/lmd1529983805787.html#section-attributes)
-   [PMD Scripting Events](/wcp_docs/lmd1529983805787.html#section-pmd-scripting-events)


## <a id="section_usage"></a>Usage

## <a id="section_VariableScope"></a>Defining the Variable Scope

Use the `variableScope` attribute of `outboundVariable` to specify its usage scope. Specify `variableScope` to 1 of these values:

-   `flow` - Flow variables are available during the lifecycle of a flow. Use flow variables to send variables to other pages in a flow. Reference the flow variables by appending their names to `flowVariables`. Example: `<% flowVariables.myFlowVariable %>`.
-   `session` - Session variables are available during the lifecycle of a user session. Reference the session variables by appending their names to `pmdSessionVariables`. Example: `<% pmdSessionVariables.mySessionVariable %>`.


<b>Note:</b> The values in `flowVariables` and `pmdSessionVariables` can't be `null`.

## <a id="section_VariableValues"></a>Defining a Collection of Variables

Use the `values[]` attribute of `outboundVariable` to define a collection of variables in 1 place. You can add variables using multiple expressions or binding values from different page widgets. To define a collection of variables, specify these attributes on each item in `values[]`:

-   `outboundPath` - The name of the variable.
-   `value` - The value of the variable.


This sample `outboundVariable` contains 2 flow variables: `workerName` whose value is `textId.value` and `isManager` whose value is `checkBoxId.value`.

```
{
  "type": "outboundVariable",
  "name": "sampleFlowVariables",
  "variableScope": "flow",
  "values": [
    {
      "outboundPath": "workerName",
      "value": "<% textId.value %>"
    },
    {
      "outboundPath": "isManager",
      "value": "<% checkBoxId.value %>"
    }    
  ]
}
```

The flow definition in the AMD and other PMDs can reference these variables using `<% flowVariables.workerName %>` and `<% flowVariables.isManager %>`.

## <a id="section_VariableValueOutBinding"></a>Defining Flow Variables on valueOutBinding Attributes

You can add variables to an `outboundVariable` using the `valueOutBinding` attribute of a PMD tag. Instead of defining the variables in the `values[]` attribute of `outboundVariable`, use the `valueOutBinding` attribute to define the variable within the context of the page widget. You can use this technique when you want to aggregate multiple field values into a single flow variable.

This sample `outboundVariable` named `workerFlowVariable` doesn't include `values[]`.

```
"outboundData": {
    "outboundEndPoints": [
      {
        "type": "outboundVariable",
        "name": "workerFlowVariable",
        "variableScope": "flow"
      }
    ]
},
```

This sample `text` uses `valueOutBinding` to store the value of `worker.descriptor` into the `workerFlowVariable.descriptor` variable:

```
{
  "type" : "text",
  "id" : "textId",
  "value" : "<% worker.descriptor %>",
  "valueOutBinding": "workerFlowVariable.descriptor"
}
```

To reference the content of the sample `workerFlowVariable.descriptor`, specify `flowVariables.workerFlowVariable.descriptor`. Example:

```
{
  "type": "text",
  "id": "reqDescriptor",
  "label": "Requisition:",
  "value": "<% flowVariables.workerFlowVariable.descriptor %>"
}
```

## <a id="section_bestPractices"></a>Best Practices

-   We recommend that you use `flowVariables` when passing variables across pages in a flow. Although you can also reference flow variables with `queryParams`, use `flowVariables` instead.
-   Use session variables with caution and at a minimum. Session variables can potentially affect performance and resource usage.
-   When you reference a property in `flowVariables`, ensure that the property already exists before you reference it. To check the empty state of a `flowVariables` property and ensure an initial value, you can use either the ternary operator `?:` or the null-coalescing operator `??`. Example: `"value": "<% flowVariables.isManager ?: false %>"`.
-   Don't store widget objects in `flowVariables` and `sessionVariables`. Example: You can't store `someGrid.getSelectedRows()` in `flowVariables`.


## <a id="section-mobile-support"></a>Mobile Support

Android, iOS

## <a id="section-attributes"></a>Attributes

-   <b>name</b>

    Data type: string

    The name of the outbound variable container.

    If you don't specify `values[]` on this outbound variable, you can reference this name when storing variables using the `valueOutBinding` attribute on the page widgets.

-   <b>values</b>

    Data type: list of value objects

    An array containing outbound variables and their values.

    An item in `values[]` contains these properties:

    -   `outboundPath` - The name of a variable.
    -   `value` - The binding value of a variable.

    <b>Note:</b> For outbound variables (both flow and session variables), the `values` attribute and `onSend` event are mutually exclusive. If you specify both, the `values` attribute takes precedence.

-   <b>variableScope</b>

    Data type: string

    Defines the usage scope of the variables in the `values` array of the `outboundVariable`. Valid values:

    -   `flow` - The variables are available during the lifecycle of a flow. Use the `flowVariables` app variable to reference the flow variables.
    -   `session` - The variables are available during the lifecycle of a user session. Use the `pmdSessionVariables` app variable to reference the session variables.



## <a id="section-pmd-scripting-events"></a>PMD Scripting Events

-   <b>onSend</b>

    Triggers just before sending the request data to an outbound variable. Specify a PMD script that returns either a List or a Map, which is the request JSON data. The `onSend` event handler can reference all widget values on the page, including composite widgets such as `grid` rows or `panelList` panels.

    For outbound variables (both flow and session variables), the `values` attribute and `onSend` event are mutually exclusive. If you specify both, the `values` attribute takes precedence.



### Related Information

[Concept: Submitting Data](/wcp_docs/rmd1572291186381.html)

