# Flow and routing

> ![A linear flow with a single exclusive decision that ends in either Approved or Needs update.](https://dev-assets.cms.uipath.com/assets/images/maestro/maestro-a-linear-flow-with-a-single-exclusive-decision-that-ends-in-either-approved-or-needs-update-620695-22c1dcf6.webp)

## Straight-through flow (step-by-step)

![A linear flow with a single exclusive decision that ends in either Approved or Needs update.](https://dev-assets.cms.uipath.com/assets/images/maestro/maestro-a-linear-flow-with-a-single-exclusive-decision-that-ends-in-either-approved-or-needs-update-620695-22c1dcf6.webp)

**Use when**

* You want a simple, linear process.
* Each task must finish before the next begins.
* There is at most one decision near the end.

**Pattern in simple words**

1. Start.
2. User task: Collect compliance forms.
3. Service task: Validate information.
4. Exclusive gateway: Complete?
   * If Yes: User task Approve supplier. End Approved.
   * If No: User task Request resubmission. End Needs update.

:::note
Keep the main path short. Defer exceptions to separate patterns.
:::

**Other scenarios**

* Finance: Process payroll batch. Approve. Send to payment.
* Insurance: Register claim. Verify data. Route to adjuster.
* Healthcare: Intake form review. Approve patient registration.
* Manufacturing: Material intake. Check specs. Approve supplier.
* Retail: Product listing. Check completeness. Publish or revise.

## Either‑or decision with default path (exclusive)

  ![Decision on stock with a default path that creates a backorder.](https://dev-assets.cms.uipath.com/assets/images/maestro/maestro-decision-on-stock-with-a-default-path-that-creates-a-backorder-620699-ffc3263d.webp)

**Use when**

* A single decision is mandatory.
* One branch should always run, even when conditions are not met.
* You want to prevent unhandled cases.

**Pattern in simple words**

1. Start.
2. Service task: Check inventory.
3. Exclusive gateway: In stock?
   * If Yes: Service task Ship order. End Shipped.
   * Default: Service task Create backorder. End Backordered.

:::note
Mark the default path on the gateway.
:::

**Other scenarios**

* Finance: Check budget. Approve or hold request.
* Healthcare: Prescription renewal. Dispense or contact doctor.
* Retail: Confirm stock. Fulfill or backorder.
* Public sector: Verify data. Approve or return for correction.
* Telecom: Check coverage. Activate or escalate.

## Do tasks at the same time, then continue (parallel)

  ![Do tasks at the same time, then continue (parallel)](https://dev-assets.cms.uipath.com/assets/images/maestro/Do_tasks_at_the_same_time_then_continueParallel-8ccc7049.webp)

**Use when**

* Several steps can run concurrently without dependencies.
* All branches must complete before moving forward.

**Pattern in simple words**

1. Start.
2. Parallel gateway: split.
   * Service task: Blood tests.
   * Service task: Imaging.
   * User task: Consent verification.
3. Parallel gateway: join.
4. User task: Review results.
5. End Ready for procedure.

   :::note
   Use a matching parallel join to synchronize.
   :::

   **Other scenarios**

* Finance: Tax filing, payments, and confirmations run together.
* Insurance: Collect claim evidence, police report, and adjuster notes in parallel.
* Manufacturing: Run QA, design validation, and material checks concurrently.
* Retail: Update pricing, marketing, and stock lists together.
* Public sector: Conduct budget, legal, and policy reviews in parallel.

## Run any needed subset, then merge (inclusive)

  ![Inclusive split with any combination of three requests, merged before assessment.](https://dev-assets.cms.uipath.com/assets/images/maestro/maestro-inclusive-split-with-any-combination-of-three-requests-merged-before-assessment-620707-91b9ee02.webp)

**Use when**

* One, several, or none of the branches may be required.
* The process must merge cleanly regardless of which branches ran.

**Pattern in simple words**

1. Start.
2. Inclusive gateway: split.
   * User task: Request photos.
   * User task: Request repair estimate.
   * User task: Request police report.
3. Inclusive gateway: merge.
4. User task: Assess claim.
5. End Decision made.

   :::note
   Use inclusive merge to handle variable combinations safely.
   :::

   **Other scenarios**

* Finance: Optional compliance or fraud checks.
* Healthcare: Trigger labs and imaging only when required.
* Retail: Gather optional marketing or packaging assets.
* Public sector: Collect specific applicant forms when applicable.
* Manufacturing: Run optional quality audits.

## First event wins (event‑based gateway)

  ![Event‑based wait that continues on approval message or on timer expiry.](https://dev-assets.cms.uipath.com/assets/images/maestro/maestro-event-based-wait-that-continues-on-approval-message-or-on-timer-expiry-620711-60c87cb6.webp)

**Use when**

* The process waits for either a reply or a deadline.
* You need “whichever happens first” behavior.

**Pattern in simple words**

1. Start.
2. Send task: Send approval request.
3. Event‑based gateway: wait for one of the following.
   * Message event: Approval received. Then user task Process request. End Approved.
   * Timer event: Seven days elapsed. Then user task Escalate decision. End Escalated
   :::note
   Keep exactly one message and one timer attached to the gateway.
   :::

**Other scenarios**

* Finance: Loan documents received versus deadline leads to auto‑decline.
* Healthcare: Lab results received versus escalate to specialist.
* Manufacturing: Engineering sign‑off versus escalate to production.
* Retail: Supplier quote versus alternate sourcing.
* Public sector: Public comment versus policy vote.
