Skip to content
flowon.com

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.

Contoso’s service desk escalates a case when a customer is at risk. Escalating a case must:

  1. Do nothing if the case is already escalated.
  2. Mark the case as escalated, assign it to the Tier 2 Support team and add it to the Escalations queue.
  3. Email every member of Tier 2 Support, including how many cases the customer has open and a link to the case.
  4. If the email cannot be sent, still escalate the case, and leave a note on it saying the email failed.
  5. Report whether the case was escalated and how many people were notified.
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
  • 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”
  1. Go to LogicLogic FlowsNew. Name the flow Escalate Case, choose your project and save.
  2. On the Input tab, add CaseId of type Lookup to Case, with Must have a value on.
  3. On the Output tab, add Escalated (Yes/No) and NotifiedCount (Whole Number).
  4. 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.

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.

# 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.

# 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.

# 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.

  1. Save the flow. If the save is refused, fix the steps that show Needs setup.
  2. Select Run, pick a test case for CaseId and run the flow. See Run and test.
  3. Check the result: Escalated is Yes and NotifiedCount is the team size. The case is owned by Tier 2 Support, sits in the Escalations queue, and has a sent email in its timeline.
  4. Run it again on the same case: this time Escalated is No, because the flow halts at AlreadyEscalated.
  • 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.
  • 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 CaseEscalated event with Publish Event so other flows can react without being called directly.