Sharing data between a calling flow and a response flow

You can share data between a flow that contains a CallableFlowAsyncInvoke node (the calling flow) and a flow that contains a CallableFlowAsyncResponse node (the response flow), by storing and retrieving data in the UserContext folder in the Environment.

Before you begin

About this task

The user context is a storage area that is used to pass data that is not part of the message between nodes in a message flow. For example, by using the user context, you can pass state from the CallableFlowAsyncInvoke node in the calling message flow to the CallableFlowAsyncResponse node in the response message flow. However, this user context data is not accessible to the called message flow.

To store user context data, you can either set a value in the Environment.CallableFlow.UserContext environment variable, or create and populate child folders below it in the message tree. For example, you can use the following command to specify context data to be stored the environment:
SET Environment.CallableFlow.UserContext = 'myData';
The specified context data is shown in the UserContext element in the message tree:
Alternatively, the user context can be a folder with a subtree, which is preserved and recreated:

When the user context data has been specified, the CallableFlowAsyncResponse node can subsequently retrieve it.

You can use a Mapping node to set a value, by mapping to the mixed child element Environment.CallableFlow.UserContext.mixed, as shown in the following diagram:
Mapping to the mixed child element.
To use a mapping node to create sub-elements, use user-defined elements or cast the xsd:any and map to them, as shown in the following diagram:
Mapping to the mixed child element.

To access the user context data after a CallableFlowAsyncResponse node, read the value or children of the Environment.CallableFlow.UserContext environment variable.