Logic Composer
Example: escalate a case
Build a realistic case escalation flow step by step, using queries, record steps, recipients, email and Try / Catch.
This example builds a complete flow that escalates a customer service case. It reads the case, stops early if there is nothing to do, counts the customer’s open cases, marks and reassigns the case, puts it in a queue, and emails the escalation team, without letting an email problem undo the escalation. Along the way it uses 13 different step types.
The scenario
Section titled “The scenario”Contoso’s service desk escalates a case when a customer is at risk. Escalating a case must:
- Do nothing if the case is already escalated.
- Mark the case as escalated, assign it to the Tier 2 Support team and add it to the Escalations queue.
- Email every member of Tier 2 Support, including how many cases the customer has open and a link to the case.
- If the email cannot be sent, still escalate the case, and leave a note on it saying the email failed.
- Report whether the case was escalated and how many people were notified.
The flow at a glance
Section titled “The flow at a glance”flowchart TD
A[GetCase] --> B{AlreadyEscalated?}
B -- Then --> C[Set Output + Halt]
B -- Else --> D[OpenCases: count]
D --> E[Mark and save case]
E --> F[Assign to Tier 2]
F --> G[Add to Escalations queue]
G --> H[Resolve Tier 2 members]
H --> I[Try: email team]
I -. fails .-> J[Catch: add note]
I --> K[Set Output]
J --> K
Before you begin
Section titled “Before you begin”- The Tier 2 Support owner team and the Escalations queue exist.
- You have a Logic Fabric project to put the flow in.
1. Create the flow and its inputs and outputs
Section titled “1. Create the flow and its inputs and outputs”- Go to LogicLogic FlowsNew. Name the flow
Escalate Case, choose your project and save. - On the Input tab, add
CaseIdof type Lookup to Case, with Must have a value on. - On the Output tab, add
Escalated(Yes/No) andNotifiedCount(Whole Number). - Optional: on the Precondition tab, add a Who can run rule Has permission: Can Write on the Case table. Users who cannot edit cases are then refused before the flow reads anything.
2. Read the case and exit early
Section titled “2. Read the case and exit early”Open the Flow tab and select Add step.
| # | Step type | Step name | Settings |
|---|---|---|---|
| 1 | Get Entity By Id | GetCase |
Entity Type: Case. Entity Id: CaseId. Columns: Case Title, Case Number, Customer, Is Escalated. |
| 2 | Condition | AlreadyEscalated |
Condition: GetCase.isescalated is Yes. |
| 2a | Set Output (in Then) | NotEscalated |
Escalated = No, NotifiedCount = 0. |
| 2b | Halt (in Then) | Stop |
No settings. |
Leave Else empty: the rest of the flow continues after the Condition. Halt ends the flow without an error and returns the outputs set before it.
3. Count the customer’s open cases
Section titled “3. Count the customer’s open cases”| # | Step type | Step name | Settings |
|---|---|---|---|
| 3 | Aggregate Query | OpenCases |
Function: Count records. Query on Case where Customer equals GetCase.customerid and Status equals Active. |
The count is calculated by the server and is available as OpenCases.Output.value, a whole number that is 0 when nothing matches.
4. Mark, assign and queue the case
Section titled “4. Mark, assign and queue the case”| # | Step type | Step name | Settings |
|---|---|---|---|
| 4 | Update Variable | MarkEscalated |
Variable: GetCase. Field Is Escalated → Set Yes. |
| 5 | Save Entity | SaveCase |
Entity: GetCase. |
| 6 | Assign Record | AssignToTier2 |
Case, CaseId. New Owner: the Tier 2 Support team. |
| 7 | Queue | AddToEscalations |
Action: Add to queue. Record: CaseId. Queue: Escalations. |
Save Entity updates the case because GetCase already has an id. Assign Record accepts only a user or a team as owner. The Queue step publishes AddToEscalations.Output.queueItemId in case a later step needs to pick or release the item.
5. Notify the team, safely
Section titled “5. Notify the team, safely”| # | Step type | Step name | Settings |
|---|---|---|---|
| 8 | Resolve Recipients | Tier2Members |
Users From: Team. Team: Tier 2 Support. |
| 9 | Try / Catch | Notify |
No settings. |
| 9a | Create Email (in Try) | EscalationEmail |
To: Tier2Members.Output.users. Regarding: CaseId. Subject: Format("Escalated: {0} ({1})", GetCase.title, GetCase.ticketnumber). Body: Format("This customer has {0} open cases. Open the case: {1}", OpenCases.Output.value, RecordUrl(CaseId)). Send the email now: on. |
| 9b | Set Output (in Try) | SetNotified |
NotifiedCount = Count(Tier2Members.Output.users). |
| 9c | Add Entity Annotation (in Catch) | LogEmailFailure |
Entity Type: Case. Entity Id: CaseId. Title: Escalation email not sent. Description: Notify.Error. |
| 9d | Set Output (in Catch) | NoneNotified |
NotifiedCount = 0. |
| 10 | Set Output | Done |
Escalated = Yes. |
Resolve Recipients returns only enabled users, each once, so the email does not go to disabled accounts. If Create Email fails, for example because the template or a recipient is invalid, Catch adds a note to the case with the error message from Notify.Error, and the flow continues to Done. The case stays escalated. NotifiedCount is the team size when the email was sent and 0 when it was not.
6. Test it
Section titled “6. Test it”- Save the flow. If the save is refused, fix the steps that show Needs setup.
- Select Run, pick a test case for
CaseIdand run the flow. See Run and test. - Check the result:
Escalatedis Yes andNotifiedCountis the team size. The case is owned by Tier 2 Support, sits in the Escalations queue, and has a sent email in its timeline. - Run it again on the same case: this time
Escalatedis No, because the flow halts atAlreadyEscalated.
7. Put it to work
Section titled “7. Put it to work”- From the case form or an app: switch on Expose as Dataverse Action (on-premises: Expose as Action) and call the action from a command button or Power Automate.
- Automatically: add the flow to the After Update stage of a Case recipe, with Applies When: set to the condition that should escalate, and Async on.
- From an AI agent: switch on Expose as MCP Tool so an agent working with your service desk can escalate cases through Logic Conductor.
Ideas to extend it
Section titled “Ideas to extend it”- Decide whether to escalate in a decision table and call it with Run Logic Block, so the rule can change without touching the flow.
- Use Share / Unshare Record to give the account manager read access to the case.
- Publish a
CaseEscalatedevent with Publish Event so other flows can react without being called directly.