# Customer case management and approval workflow

## Portfolio status

This is an implementation blueprint and interactive web prototype for a fictional bank. It is not a deployed Power Apps or Power Automate solution. Records and names are synthetic.

## Goal

Help branch staff record customer complaints, assign an owner, request an escalation approval where needed, and keep a clear action history. The prototype shows the intended state transitions; a real deployment would need security, retention, notification, accessibility and operational testing.

## Suggested Power Platform components

| Component | Purpose |
| --- | --- |
| Power Apps canvas app | Case intake, queue, detail, actions and manager review |
| Dataverse | Cases, actions, approval requests and controlled choice values |
| Power Automate cloud flow | On submission, notify assigned team; on approval request, route to manager; on decision, record outcome and notify owner |
| Power BI | Case volume, aging, SLA, reopen rate and trends by branch and reason |

## Dataverse tables

`Case` — CaseId (alternate key), Title, Branch, Category, ReceivedAt, DueAt, Priority, Status, Owner, Summary, CustomerReference (redacted/pseudonymous in sample), EscalationRequired, ResolvedAt, RowVersion.

`CaseAction` — ActionId, CaseId lookup, ActionType, Actor, PerformedAt, Notes, FromStatus, ToStatus. Append only for audit purposes.

`ApprovalRequest` — RequestId, CaseId lookup, RequestedBy, RequestedAt, Approver, Decision, DecidedAt, DecisionNotes. One active request per case.

## State rules

1. New → Assigned when an owner accepts the case.
2. Assigned → Awaiting approval when escalation is requested.
3. Awaiting approval → In progress on manager approval, or → Assigned on return with required notes.
4. Assigned / In progress → Resolved after resolution summary is entered.
5. Resolved → Reopened when a follow-up reason is entered.

Prevent a case from being resolved while an approval is pending. Restrict approval decisions to a manager who is not the requester. Record every transition as a CaseAction row with timestamp and actor. Use server-side checks or a flow to prevent duplicate approvals after concurrent clicks.

## Flow triggers

**On case created**: validate required fields; calculate due date from the applicable policy calendar; assign queue by branch/category; create action entry; notify queue.

**On approval requested**: check status and existing active request; create ApprovalRequest; send manager approval with the case reference and minimum necessary information; update case status only after request is created.

**On approval decision**: record actor, time and decision; update case status; append action; notify owner. Handle timeout, rejection, resubmission, and duplicate events idempotently.

**Daily exception check**: find unresolved cases past due; notify owner/manager once per escalation level; log notification; avoid sending sensitive case summaries by email.

## Roles and access

Branch agent: create and update cases in assigned branch; see only the case data needed for their work. Manager: review approvals and branch queue, no self-approval. Administrator: configure routing and monitor flow failures. Apply Dataverse security roles and field security where needed. Avoid using a client-side filter as an access control.

## Acceptance checks

- Agent submits a complete case and sees it in their branch queue with an action entry.
- Missing required fields prevent submission and identify the field to fix.
- A second approval request on the same case is rejected while one is open.
- The requester cannot approve their own request; a branch manager can approve or return it with notes.
- The case cannot be resolved while approval is pending.
- Reopen requires a reason; history retains the earlier resolution and decision.
- A delayed or repeated flow event does not create duplicate actions or notifications.
- Users from another branch cannot retrieve the case through direct identifiers or exports.
- Queue filters and aging use the agreed time zone and due-date policy.

## Portfolio discussion

The companion web prototype demonstrates queue filtering, case detail, assignment, approval decision, resolution and an activity history using in-browser synthetic state. It deliberately does not represent a real Dataverse connection or automated notification.
