# Run Flows Configured Online

This pattern runs a flow whose modules and configuration are defined on the Incode Dashboard rather than in your app code. Your app supplies a `configurationId`, and the SDK pulls everything else from the dashboard.

Use this pattern when you want to change the onboarding configuration from the dashboard without releasing a new app version.

## Prerequisite

The SDK must be initialized before you start a flow. See [Installation](installation) for the `initializeSDK()` call and its arguments.

## Workflows and Flows

Incode distinguishes between two dashboard-defined artifacts:

- **Workflows** are governed by Conditions and are started with `startWorkflow()`.
- **Flows** are governed by the Rules Engine and are started with `startFlow()`.

Which one you use depends on how the artifact was configured in Dashboard. Your app must know in advance which method to use; the SDK does not detect Workflow vs. Flow at runtime. If you're not sure which you have, check Dashboard or ask the team that configured it.

## Run a Workflow

Use `startWorkflow()` to run a dashboard-defined Workflow end to end.

```js
let sessionConfig = {
  configurationId: "your-workflow-id", // required
  region: "ALL"
};

cordova.exec(
  function (result) { console.log("Workflow result:", result); },
  function (error) { console.log("Workflow error:", error); },
  "Cplugin",
  "startWorkflow",
  [sessionConfig]
);
```

## Run a Flow

Use `startFlow()` to run a dashboard-defined Flow. You can optionally pass a `moduleId` to start from a specific module rather than the first one. See [Modules](#) for the list of supported modules.

```js
let sessionConfig = {
  configurationId: "your-flow-id" // required
};
let moduleId = "EMAIL"; // optional; omit to start from the first module

cordova.exec(
  function (winParam) { console.log("Flow result:", winParam); },
  function (err) { console.log("Flow error:", err); },
  "Cplugin",
  "startFlow",
  [sessionConfig, moduleId]
);
```

## Results

Both `startWorkflow()` and `startFlow()` return results whose structure depends on which modules ran. See [Results](results) for the full structure and the list of error strings.

## Related pages

- [Results](results): the structure of workflow and flow results, and the list of error strings.
- [API Reference](api-reference): the full signatures of `startWorkflow()` and `startFlow()`, and every field on `sessionConfig`.

<br />
