Sending inputs to a flow

We can pass data to a flow as it is being initialized; giving us the flexibility to launch predefined tasks (for example, search for a specific record, and load the details) as soon as a flow starts.

This input data is accessible through a query string when the flow starts. This is what a Flow Run URL would look like: https://flow.manywho.com/<tenant-id>/play/player?flow-id=<flow-id>&flow-version-id=<flow-version-id>&example-data1=123&example-data2=abc

The first thing we need to do for this, is create a new player. We will customize the player code next.

  1. Open the new player. (We are calling the player Input.)
  2. We will capture the data sent as a query string, on line 126 after manywho.settings.initialize add the following code:
  3. For the Flow engine to recognize this as valid inputs, we need to create an inputs array. Let’s add this code to the player now:
  4. Let’s find the options object inside the initialize function. To send the input data into the flow, it has to be available as an option when the flow is being initialized. We will change inputs: null, line.

    Replace null with the variable containing the input description, something like: inputs: exampleInputs,
  5. Lastly, we will create a value for each of the inputs being set. The names of the values will match the property names of the input data we sent to the flow. (In this example, we would create a value called example-data1 and another one called example-data2). Be sure to select Input or Input/Output as the option for Access when creating the value.

When we run our flow, it will automatically populate these values with the data upon initialization.