Power Automate Desktop (PAD): The Complete Beginner to Advanced Guide
Version: July 2026 | Audience: Beginners, IT Professionals, Developers, Power Platform Developers, Automation Engineers, Solution Architects
Table of Contents
- Introduction to RPA
- What is Power Automate Desktop?
- Why Microsoft Built PAD
- Power Automate Desktop Architecture
- Desktop Flow vs Cloud Flow
- Installing Power Automate Desktop
- Licensing
- System Requirements
- User Interface Overview
- Creating Your First Desktop Flow
- Understanding Variables
- Data Types
- Input and Output Variables
- Actions Explained
- Control Flow
- Conditions
- Loops
- Switch Statements
- Error Handling
- Exception Management
- Working with Files
- Working with Folders
- Excel Automation
- PDF Automation
- Word Automation
- CSV Automation
- JSON Handling
- XML Handling
- Clipboard Operations
- Date & Time
- Text Manipulation
- Regular Expressions
- Email Automation
- Outlook Automation
- Browser Automation
- Web Scraping
- UI Automation
- OCR
- AI Builder Integration
- Database Automation
- SQL Server Integration
- REST API Calls
- HTTP Requests
- PowerShell Integration
- CMD Integration
- VBScript Integration
- Python Integration
- Running External Applications
- Windows Automation
- Keyboard Automation
- Mouse Automation
- Screen Recording
- Image Recognition
- Computer Vision
- Credentials Management
- Environment Variables
- Logging
- Debugging
- Breakpoints
- Performance Optimization
- Reusable Subflows
- Custom Functions
- Exception Framework
- Best Practices
- Enterprise Design Patterns
- Source Control
- Deployment
- Scheduling Desktop Flows
- Running Unattended Bots
- Running Attended Bots
- Machine Groups
- Gateways
- Security Best Practices
- Governance
- DLP Policies
- Monitoring
- Analytics
- Troubleshooting
- Common Errors
- Interview Questions
- Real-world Projects
- End-to-End Case Study
- Enterprise Architecture
- Frequently Asked Questions
- Cheat Sheet
- Glossary
- Learning Resources
- Hands-on Labs
Part I — Foundations
1. Introduction to RPA
Overview
Robotic Process Automation (RPA) is software that mimics human interaction with digital systems — clicking buttons, typing into fields, reading screens, moving files, and copying data between applications. An RPA "bot" follows a defined set of steps (a flow or process) exactly as a human operator would, but faster, without fatigue, and without transcription errors.
RPA is fundamentally different from API-based integration:
| Aspect | API Integration | RPA |
|---|---|---|
| How it connects | Programmatic interfaces (REST, SOAP, connectors) | The user interface (screens, windows, browsers) |
| Requires system changes | Sometimes (endpoints, auth setup) | No — works on the app "as-is" |
| Best for | Modern systems with APIs | Legacy apps, green screens, thick clients, apps with no API |
| Fragility | Low (contracts are stable) | Higher (UI changes can break selectors) |
| Speed to deliver | Slower (development effort) | Fast (record and refine) |
Why It Matters
Organizations run on repetitive, rule-based processes: invoice entry, report downloads, data reconciliation, onboarding checklists, copying data from email into ERP systems. RPA delivers:
- Cost reduction — bots handle high-volume tasks at a fraction of manual cost.
- Accuracy — no typos, no skipped rows.
- Speed and availability — 24/7 unattended execution.
- Employee satisfaction — humans move to judgment-based work.
- Bridging legacy systems — automation without modernizing the underlying app.
Attended vs Unattended Automation
| Mode | Trigger | Human present? | Typical use |
|---|---|---|---|
| Attended | User starts it (console, hotkey, cloud flow in "attended" mode) | Yes — runs on the user's session | Help-desk assistance, front-office tasks, "digital assistant" scenarios |
| Unattended | Scheduled or triggered from the cloud | No — bot signs into the machine itself | Batch jobs, overnight processing, high-volume back-office work |
Common Mistakes
- Automating a broken process instead of fixing it first ("paving the cow path").
- Choosing RPA when a stable API/connector exists — always prefer APIs when available.
- Skipping exception design — real-world screens change, pop-ups appear, networks drop.
Summary
RPA automates the user interface layer. It shines where APIs don't exist. Attended bots assist humans; unattended bots replace manual batch work. Power Automate Desktop is Microsoft's RPA tool inside the broader Power Automate family.
2. What is Power Automate Desktop?
Overview
Power Automate for desktop (commonly called PAD) is Microsoft's desktop RPA application. It lets you build desktop flows — automations that run on a Windows machine and interact with desktop applications, browsers, files, terminals, and legacy systems — using a low-code, drag-and-drop designer with 400+ prebuilt actions.
PAD is part of the Power Automate service, which also includes:
- Cloud flows — API/connector-based automations (DPA) running in the Microsoft cloud.
- Desktop flows — RPA running on Windows machines (built with PAD).
- Process mining — process discovery and analysis.
Why It Matters
- Included with Windows: Windows 11 users can launch PAD directly from the Start menu — it downloads automatically on first use, dramatically lowering the barrier to RPA.
- Low-code: business users can record actions; developers can extend with scripts.
- Integrated: desktop flows can be triggered by cloud flows, monitored in the Power Automate portal, governed by Power Platform admin tools, and stored in Dataverse.
Key Capabilities at a Glance
| Category | Examples |
|---|---|
| Desktop & Windows | Launch apps, manipulate windows, services, registry, environment variables |
| Web | Browser automation (Edge, Chrome, Firefox), data extraction, form filling |
| UI automation | Click, type, read from any Windows application via UI elements |
| Files & folders | Copy, move, rename, zip, monitor folders |
| Office | Excel, Outlook, Word (modern actions), CSV |
| Data | SQL databases, JSON, XML, text parsing, regex |
| Vision & AI | OCR (Tesseract/Windows OCR engines), image recognition, AI Builder |
| Scripting | PowerShell, CMD, VBScript, Python (IronPython), JavaScript, .NET |
| Integration | HTTP/REST calls, invoke other desktop flows, cloud flow integration |
Summary
PAD = Microsoft's low-code RPA studio for Windows. It builds desktop flows that can run attended or unattended and integrate tightly with cloud flows and the Power Platform.
3. Why Microsoft Built PAD
Overview
Microsoft entered RPA later than UiPath, Automation Anywhere, and Blue Prism. The strategy unfolded in three moves:
- UI flows (2019) — a first-party RPA capability inside Power Automate.
- Softomotive acquisition (May 2020) — Microsoft acquired Softomotive, maker of WinAutomation. WinAutomation's mature designer and action library became the foundation of Power Automate Desktop.
- PAD free with Windows (2021) — Microsoft announced PAD would be available to Windows 10/11 users at no additional cost for local, attended authoring, making it the most accessible RPA tool in the market.
Why It Matters
- Democratization: every Windows user is a potential citizen developer.
- Platform play: PAD locks into Dataverse, AAD/Entra ID, DLP policies, and the Power Platform admin center — a governance story competitors must bolt on.
- Hyperautomation: combined with AI Builder, Copilot, process mining, and cloud flows, Microsoft sells an end-to-end automation platform, not just a bot tool.
Summary
PAD exists because Microsoft wanted RPA natively inside the Power Platform and Windows. Understanding this lineage (WinAutomation DNA) explains many designer conventions you'll meet.
4. Power Automate Desktop Architecture
Overview
PAD consists of several cooperating components on the machine, plus cloud services.
On-machine components
| Component | Role |
|---|---|
| Console | Launcher/manager: list, run, and organize desktop flows |
| Flow Designer | The IDE: build flows from actions, debug, test |
| Desktop flow runtime (Robot) | Executes the flow's actions at runtime |
| Machine-runtime app | Registers the machine with the cloud; enables cloud-triggered runs |
| Browser extensions | Bridge for Edge/Chrome/Firefox automation |
| UI automation framework | Uses Windows accessibility APIs (UIA) to inspect and drive app UIs |
Cloud components
| Component | Role |
|---|---|
| Power Automate portal | Manage flows, machines, machine groups, run history |
| Dataverse | Stores desktop flow definitions, connections, run logs |
| Cloud flow "Run a flow built with PAD" action | Orchestrates desktop flow execution |
| Power Platform admin center | Governance, DLP, environments, monitoring |
Architecture Diagram
flowchart TB
subgraph Cloud["Microsoft Cloud"]
P[Power Automate Portal]
CF[Cloud Flows]
DV[(Dataverse)]
PPAC[Power Platform Admin Center]
end
subgraph Machine["Windows Machine"]
C[PAD Console]
D[Flow Designer]
R[Desktop Flow Runtime]
MR[Machine-Runtime App]
BE[Browser Extensions]
UIA[UI Automation / Win32 APIs]
end
Apps[Desktop Apps / Browsers / Files / Legacy Systems]
P --- DV
CF -->|"Run desktop flow"| MR
MR --> R
C --> D
D -->|Save| DV
R --> BE --> Apps
R --> UIA --> Apps
R -->|Run logs| DV
PPAC --- DV
Note
Desktop flow definitions authored while signed in with a work/school account are stored in Dataverse in the selected environment — not on the local disk. This is what enables sharing, ALM, and cloud triggering.
Best Practices
- Keep the machine-runtime app and PAD on the same version cadence; mismatches cause registration failures.
- On shared/unattended machines, install via MSI (includes machine runtime) rather than Store.
Summary
PAD = local designer + runtime + machine registration, backed by Dataverse and orchestrated by cloud flows. Everything an enterprise needs (storage, identity, governance) rides on the Power Platform.
5. Desktop Flow vs Cloud Flow
Overview
| Dimension | Cloud Flow | Desktop Flow |
|---|---|---|
| Runs where | Microsoft cloud | A Windows machine |
| Automates | APIs via 1,000+ connectors | UIs, files, local apps |
| Triggers | Automated (events), scheduled, instant | From console, cloud flow, schedule via cloud flow |
| Built with | Power Automate portal (browser) | Power Automate for desktop app |
| Best for | SaaS-to-SaaS integration, approvals, notifications | Legacy apps, desktop apps, anything without an API |
| Licensing | Per-user plans | Premium (attended) / Process (unattended) |
How They Work Together
The most powerful pattern is cloud flow as orchestrator, desktop flow as worker:
sequenceDiagram
participant T as Trigger (email arrives)
participant CF as Cloud Flow
participant M as Machine / Machine Group
participant DF as Desktop Flow
participant ERP as Legacy ERP
T->>CF: New invoice email
CF->>CF: Extract attachment, call AI Builder
CF->>M: Run desktop flow (input: invoice data)
M->>DF: Execute on registered machine
DF->>ERP: Type invoice into legacy ERP UI
DF-->>CF: Output variables (status, doc number)
CF->>T: Post result to Teams / update tracker
Tip
Push every step that can be done with a connector into the cloud flow. Reserve the desktop flow for the UI-only portion. This minimizes machine time (which is your licensing bottleneck) and maximizes reliability.
Summary
Cloud flows integrate APIs; desktop flows integrate screens. Design hybrid solutions with the cloud flow as the brain and the desktop flow as the hands.
6. Installing Power Automate Desktop
Overview
There are two supported installation channels — you must pick one (side-by-side is not supported):
| Channel | Admin rights | Updates | Machine runtime included | Best for |
|---|---|---|---|---|
| MSI installer (download center) | Required | Manual | Yes (optional component) | Unattended machines, enterprise deployment |
| Microsoft Store (MSIX) | Not required | Automatic | No (install separately from MSI) | Individual makers, attended use |
On Windows 11, searching "Power Automate" in the Start menu auto-downloads the app on first launch.
Step-by-Step Tutorial (MSI)
- Download
Setup.Microsoft.PowerAutomate.exefrom the Microsoft download center. - Run the installer as administrator.
- Select components:
- Power Automate for desktop (designer + console)
- Machine-runtime app (check this for cloud connectivity/unattended)
- Java bridge files (only if automating Java applets — close Java processes first)
- Accept terms → Install.
- Install browser extensions when prompted (Edge/Chrome/Firefox) — required for web automation.
- Launch PAD and sign in with your work or school account (organization scenarios) or Microsoft account (personal).
- If prompted, select your environment (where flows will be stored in Dataverse).
Screenshot: PAD installer component-selection screen with "Install machine-runtime app" checked.
Warning
The x86 package is installed even on x64 systems because some automation modules run only in 32-bit mode. Do not "clean up" these components.
Troubleshooting
| Symptom | Fix |
|---|---|
| Install fails with generic error | Check the installer log in %TEMP%; verify .NET 8 runtime prerequisites |
| Browser automation not working | Reinstall the browser extension; ensure the extension is enabled and browser restarted |
| Both Store and MSI versions present | Uninstall one — dual installs are unsupported |
| Can't create flows after sign-in | Your default environment needs a provisioned Dataverse database |
Summary
Use MSI for enterprise/unattended machines; Store for personal attended use. Always install the machine runtime and browser extensions if you plan cloud-triggered or web automation.
7. Licensing
Note
Prices below are USD list prices verified against Microsoft licensing documentation as of mid-2026. Licensing changes frequently — always confirm on the official Power Automate pricing page before purchase decisions.
Overview
| Plan | Price (USD, list) | What it covers |
|---|---|---|
| Power Automate (M365 seeded) | Included with Microsoft 365 | Cloud flows with standard connectors only; PAD authoring for local attended use |
| Power Automate Premium | $15 / user / month | Full cloud flows, premium + custom connectors, attended RPA, process mining visualization, AI Builder credits |
| Power Automate Process | $150 / bot / month | One unattended bot ("automation" identity); includes the cloud flows that invoke it on that machine; no minimum purchase |
| Power Automate Hosted Process | $215 / bot / month | Same as Process, but the bot machine is Microsoft-hosted on Azure — no infrastructure to manage |
Retired: the legacy per-flow plan and unattended RPA add-on were removed from price lists (Feb 2024) in favor of Process licenses.
Key Rules to Remember
- Attended RPA ⇒ every user who runs the desktop flow needs Premium.
- Unattended RPA ⇒ one Process license per concurrent bot session on a machine; a machine needing 3 parallel unattended sessions needs 3 Process licenses.
- Unattended automation of Microsoft 365 apps may additionally require the Microsoft 365 Unattended License per product terms.
- Windows 10/11 users can build and run flows locally for free, but cloud triggering, sharing, and unattended runs require paid plans.
Decision Tree
flowchart TD
A[Need desktop RPA?] -->|No| B[Premium or M365 seeded for cloud flows]
A -->|Yes| C{User present during run?}
C -->|Yes - attended| D[Premium: $15/user/mo]
C -->|No - unattended| E{Manage own machine?}
E -->|Yes| F[Process: $150/bot/mo]
E -->|No| G[Hosted Process: $215/bot/mo]
Common Mistakes
- Assuming M365 E3/E5 covers premium connectors — it doesn't.
- Forgetting the Microsoft 365 Unattended License when a bot drives Office apps unattended.
- Licensing every employee with Premium when only flow runners need it.
Summary
Free locally, $15/user for attended, $150/bot for unattended, $215/bot hosted. License the runtime pattern, not the tool.
8. System Requirements
Overview
Verified against Microsoft's prerequisites documentation:
| Requirement | Minimum | Recommended |
|---|---|---|
| Processor | 1.0 GHz, 2+ cores (4+ cores for unattended) | 1.6 GHz+, 2+ cores (4+ for unattended) |
| RAM | 2 GB | 4 GB+ |
| Storage | 1 GB free | 2 GB+ |
| Display | Required for UI automation (or virtual display driver for unattended) | — |
| .NET | .NET 8 runtime (installed with PAD) | — |
| Network | Required for sign-in, Dataverse storage, cloud runs | — |
Supported operating systems: Windows 10 (Home/Pro/Enterprise), Windows 11 (Home/Pro/Enterprise), Windows Server 2016 / 2019 / 2022 / 2025. ARM devices are not supported.
Warning
Windows Home editions can author and run flows locally, but cannot be triggered from the cloud (no unattended/cloud-connected runs). Use Pro/Enterprise/Server for enterprise scenarios.
Other notable limits:
- Desktop flows in v1 schema environments must stay under 100 MB — split large flows into smaller ones.
- Only work/school accounts with a Dataverse database in the environment can create desktop flows there.
- Multi-session Windows (e.g., Server, Windows 11 Enterprise multi-session) supports high-density unattended bots — each bot gets its own user session.
Summary
Any modern Windows Pro/Enterprise/Server machine works. Plan 4+ cores for unattended hosts, avoid Home editions and ARM for production.
9. User Interface Overview
Overview
PAD has two main surfaces:
The Console
- Lists My flows and shared flows, with run/edit/schedule status.
- Machine settings (registration, machine groups).
- Environment picker (top bar) — controls where flows are stored.
Screenshot: PAD Console showing the "My flows" list with Run, Stop, and Edit buttons.
The Flow Designer
| Area | Purpose |
|---|---|
| Actions pane (left) | Searchable library of 400+ actions grouped by category |
| Workspace (center) | The flow: an ordered list of action steps; supports subflow tabs |
| Variables pane (right) | Input/output variables and flow variables with live values during runs |
| UI elements pane | Captured selectors for desktop/web elements |
| Images pane | Captured images for image-based automation |
| Toolbar | Run, Stop, Run next action (step), Recorder, Save |
| Errors pane (bottom) | Design-time and runtime errors |
Screenshot: Flow Designer with the Actions pane, a flow in the workspace, and the Variables pane visible.
Tip
Learn the keyboard shortcuts early: F5 run, F10 step over (run next action), F6 toggle breakpoint, Ctrl+F search actions. See the Cheat Sheet.
Summary
Console = manage and run. Designer = build and debug. The Variables, UI elements, and Images panes are where the real state of your automation lives.
Part II — Building Flows
10. Creating Your First Desktop Flow
Overview
Let's build the canonical "hello world" of PAD: a flow that asks for your name, builds a greeting, and writes it to a text file.
Step-by-Step Tutorial
- In the Console, select + New flow, name it
HelloWorld, and choose Create. The Designer opens. - Drag Message boxes → Display input dialog into the workspace.
- Input dialog title:
Welcome - Input dialog message:
What is your name? - Output:
UserInput(produced automatically)
- Input dialog title:
- Drag Variables → Set variable.
- Variable:
Greeting - Value:
Hello %UserInput%! Today is %CurrentDateTime%(add a "Get current date and time" action before this step to produceCurrentDateTime)
- Variable:
- Drag File → Write text to file.
- File path:
C:\PADDemo\greeting.txt - Text to write:
%Greeting% - If file exists: Overwrite
- File path:
- Press F5 (Run). Type your name; check
C:\PADDemo\greeting.txt. - Save (Ctrl+S). The flow is stored to Dataverse and appears in the Console.
Screenshot: The completed 4-action HelloWorld flow in the Designer workspace with the Variables pane showing
UserInputandGreetingvalues after a run.
The %...% Notation
Everything between percent signs is evaluated: variables (%UserName%), properties (%File.NameWithoutExtension%), expressions (%Counter + 1%), and literals-with-logic (%If(x > 5, 'big', 'small')% is not supported — use Condition actions instead; only basic operators work inside % %).
Common Mistakes
- Typing variable names without
%— you'll write the literal text, not the value. - Hardcoding paths like
C:\Users\yourname\...— use%SpecialFolder%-producing actions or input variables. - Forgetting to Save — running a flow doesn't save it.
Summary
Actions produce variables; variables feed later actions via %name%. Build → Run → Inspect variables → Save. That's the core loop of PAD development.
11. Understanding Variables
Overview
Variables are named containers holding values during a flow run. PAD variables are:
- Dynamically typed — the type comes from the value assigned.
- Flow-scoped — visible to all subflows in the same desktop flow (there is no block-level scoping).
- In-memory — they exist only during the run (persist state externally if needed).
Creating and Using Variables
| Method | Example |
|---|---|
| Action output | Launch Excel produces ExcelInstance |
| Set variable action | Counter = 0 |
| Input variables | Supplied by user or a calling cloud flow |
| Expressions | %Counter + 1%, %Price * Quantity% |
Properties: many variables expose dot-properties — e.g., for a file variable %File1.Name%, %File1.Extension%, %File1.LastModified%; for datatables %Table.RowsCount%.
Naming Best Practices
| Convention | Example | Why |
|---|---|---|
| PascalCase | InvoiceTotal |
Matches PAD's own outputs |
| Type-hint prefixes (team choice) | numRetryCount, strFilePath, dtInvoices |
Readability in large flows |
| No spaces/special chars | CustomerName not customer name |
Prevents expression errors |
| Rename default outputs | ExcelInstance → ExcelInvoices |
Multiple instances stay distinguishable |
Tip
Mark internal variables as sensitive (right-click → Mark as sensitive) to mask their values in logs and the variables pane — essential for anything credential-like.
Summary
Variables are dynamic, flow-global, and property-rich. Rename action outputs meaningfully and mark secrets as sensitive.
12. Data Types
Overview
| Type | Example | Notes |
|---|---|---|
| Text | 'Hello' |
The default; most action outputs |
| Numeric | 42, 3.14 |
One numeric type for int/decimal |
| Boolean | %True% / %False% |
Used by conditions |
| Datetime | %CurrentDateTime% |
Rich formatting/arithmetic support |
| List | %List[0]% |
Ordered items, zero-indexed |
| Datatable | %Table[2]['Amount']% |
Rows × named columns; the workhorse for Excel/DB data |
| Datarow | %Row['Status']% |
Single row from a datatable |
| Custom object | %Obj.ToCustomObject% / JSON |
Key-value structures; maps to JSON |
| Instances | ExcelInstance, Browser |
Handles to live applications |
| Files/Folders | %File.FullName% |
Filesystem items with properties |
| UI element / Window | — | Captured selectors |
| Connection references | — | Cloud connector connections (newer actions) |
Conversions
- Convert text to number / number to text / text to datetime / datetime to text actions handle explicit conversion with culture and format control.
- Implicit conversion happens in expressions but fails loudly when text isn't numeric — convert explicitly at trust boundaries (user input, Excel cells, scraped text).
Warning
Excel cells frequently return numbers as text (or dates as serials). Always run Convert text to number / Convert text to datetime before arithmetic or comparisons, or your
>comparison will compare alphabetically.
Summary
Master text, numeric, datetime, list, datatable, and custom object — 95% of flows use only these. Convert explicitly at data boundaries.
13. Input and Output Variables
Overview
Input/output variables are the contract between a desktop flow and its caller (a person, another desktop flow, or a cloud flow).
- Input variables — values passed in at start (with defaults for local testing).
- Output variables — values returned out at completion.
Step-by-Step: Add an Input Variable
- In the Variables pane, select + under Input/output variables → Input.
- Name:
InvoiceFolderPath; External name:Invoice Folder Path; Type: Text; Default:C:\Invoices; Description: where the bot reads PDFs. - Use
%InvoiceFolderPath%anywhere in the flow.
When a cloud flow calls this desktop flow via Run a flow built with Power Automate for desktop, each input appears as a field in the cloud action, and each output appears as dynamic content afterward.
Best Practices
- Treat inputs as untrusted: validate paths exist, numbers parse, and required values aren't empty at the top of the flow.
- Return a structured output contract: at minimum
Status(Success/BusinessError/SystemError),Message, and any business results. - Mark sensitive inputs (passwords) as sensitive text.
Summary
Inputs/outputs make desktop flows composable and cloud-callable. Design them like an API contract.
14. Actions Explained
Overview
An action is one step of work — the atomic unit of a PAD flow. Each action has parameters (inputs), produces zero or more variables (outputs), and can raise errors. Actions are grouped into ~40 categories (Variables, Conditionals, Loops, Flow control, System, Files, Folders, Excel, Browser automation, UI automation, and so on).
Anatomy of an Action
| Part | Description |
|---|---|
| Parameters | Required and optional inputs; support % % expressions |
| Produced variables | Toggle off outputs you don't need |
| On error tab | Per-action error handling: retry policy, continue/ignore, set variable, run subflow, throw |
| Comment | Right-click → add a comment above the action |
Tip
The On error tab supports "Retry action — N times, every S seconds." For flaky UI/web steps, a 3× retry with 2-second delay eliminates most transient failures without any extra flow logic.
Working Efficiently
- Search the action pane (Ctrl+F) rather than browsing.
- Disable actions (right-click → Disable) instead of deleting during testing.
- Copy/paste actions between flows — they serialize to text, which also enables sharing snippets and source-control diffs.
- Use Regions (Flow control → Region) to fold long flows into named collapsible blocks.
Summary
Actions are configurable, error-aware steps. Learn the On-error tab early — it's PAD's most underused reliability feature.
15. Control Flow
Overview
Control flow determines the order in which actions execute:
| Construct | Actions |
|---|---|
| Sequence | Default top-to-bottom execution |
| Branching | If / Else if / Else, Switch / Case |
| Iteration | Loop, For each, Loop condition |
| Jumps | Labels + Go to (use sparingly), Exit loop, Next loop |
| Decomposition | Subflows, Run subflow |
| Termination | Stop flow (with success/error), Exit subflow |
| Waiting | Wait, Wait for window/image/file/service |
flowchart TD
S[Start] --> V[Validate inputs]
V -->|valid| P[Process items loop]
V -->|invalid| E[Stop flow with error]
P --> C{More items?}
C -->|Yes| W[Process one item] --> P
C -->|No| R[Write results] --> X[End]
Warning
Avoid
Go to/labels except for legacy patterns — they create spaghetti. Prefer subflows and structured loops.
Summary
PAD gives you the full structured-programming toolkit. Compose it with subflows for readability.
16. Conditions
Overview
Condition actions branch execution:
| Action | Use |
|---|---|
| If / Else if / Else | General comparisons: equals, not equals, >, <, contains, starts with, is empty, is blank |
| Case-insensitive option | Text comparisons without normalizing first |
| If file exists / If folder exists | Filesystem guards |
| If window contains / If image / If text on screen (OCR) | UI state checks |
| If service / If process | System state |
Example
Check an invoice amount and route accordingly:
If %InvoiceAmount% > 10000 then
Run subflow: RequestManagerApproval
Else if %InvoiceAmount% > 0 then
Run subflow: AutoPost
Else
Run subflow: LogValidationError
End
Common Mistakes
- Comparing numeric-looking text with
>(alphabetical result). Convert first. - Testing
is emptyon a list vsis blankon text — pick the right operator for the type. - Deep nesting — beyond 2–3 levels, refactor to Switch or subflows.
Summary
Use the specialized "If X exists" guards liberally — they're cheaper and clearer than try/catch for expected states.
17. Loops
Overview
| Loop action | Iterates over | Typical use |
|---|---|---|
| Loop | A counter from start to end by increment | Fixed-count repetition, retry counters |
| For each | Items in a list, datatable rows, files in folder | Processing collections (the most common) |
| Loop condition | While a condition is true | Polling, wait-until patterns |
Control inside loops: Exit loop (break) and Next loop (continue).
Example — Process every Excel row
Launch Excel: open Invoices.xlsx → ExcelInstance
Read from Excel worksheet (range, first line = headers) → InvoiceTable
For each CurrentRow in InvoiceTable
If %CurrentRow['Status']% = 'Pending' then
Run subflow: PostInvoice (uses %CurrentRow['InvoiceNo']%, %CurrentRow['Amount']%)
End
End
Close Excel
Tip
Never do "read cell, move down one row" loops against Excel. Read the whole range into a datatable once, loop in memory, then write results back in one operation — it's 10–100× faster.
Loop Condition for polling
Set variable Attempts = 0
Loop condition: While %FileReady% = %False% AND %Attempts% < 30
If file exists C:\Drop\report.csv → Set FileReady = %True%
Wait 10 seconds
Set Attempts = %Attempts + 1%
End
Summary
For each + datatables is the backbone of business flows. Batch I/O outside the loop; keep only logic inside it.
18. Switch Statements
Overview
Switch evaluates one value; Case blocks match candidates; Default case catches everything else. Cleaner than chained Else-ifs when routing on a single discriminator.
Example
Switch on %DocumentType%
Case = 'Invoice' → Run subflow ProcessInvoice
Case = 'PurchaseOrder'→ Run subflow ProcessPO
Case = 'CreditNote' → Run subflow ProcessCreditNote
Default case → Run subflow MoveToManualReview
End
Cases support operators beyond equality (>, <, contains), evaluated top-down — first match wins.
Summary
One value, many routes → Switch. Always include a Default case that handles the unexpected explicitly.
19. Error Handling
Overview
PAD errors come in two layers:
- Action-level ("On error" tab) — per-action: retry, continue with next action, set a variable, run a subflow, or throw.
- Block-level ("On block error" action) — wraps a group of actions like try/catch: on any error inside, optionally run a subflow, then continue at end of block / beginning of block / a label / throw.
Exception Flow Diagram
flowchart TD
A[Action executes] --> B{Error?}
B -->|No| N[Next action]
B -->|Yes| R{On-error: Retry?}
R -->|Retries left| A
R -->|Exhausted| H{Handled on action?}
H -->|Continue / set var / subflow| N
H -->|Not handled| BLK{Inside On block error?}
BLK -->|Yes| BH[Run error subflow → continue per rule]
BLK -->|No| F[Flow fails: error bubbles to caller / run history]
Step-by-Step: Try/Catch a Fragile Section
- Add Flow control → On block error, name:
TryPostInvoice; check Run subflow →HandlePostingError; select Continue flow run → Go to end of block. - Place the risky actions (open app, type, submit) inside the block.
- In
HandlePostingError: capture%LastError%... log it, screenshot the desktop (Take screenshot action), setStatus = 'SystemError'.
Business vs System Exceptions
| Type | Example | Handling |
|---|---|---|
| Business exception | Invoice missing PO number | Don't retry — route to human queue, mark item "BusinessError" |
| System exception | App crashed, selector not found, timeout | Retry (fresh state), then escalate; mark "SystemError" |
Best Practices
- Retry at the action for transient issues; retry the whole item (clean state) for system exceptions.
- Always capture a screenshot + error details on unhandled failure — it converts "it failed" into a 2-minute diagnosis.
- Never swallow errors with blanket "continue" — handle, log, or throw.
Summary
Combine On-error retries (micro) with On block error regions (macro), and separate business from system exceptions. This trio is the foundation of reliable bots.
20. Exception Management
Overview
Exception handling is the mechanics (chapter 19); exception management is the strategy across a whole automation estate:
| Element | Practice |
|---|---|
| Classification | Every failure ends as BusinessError, SystemError, or Success — no "unknown" |
| Item-level isolation | One bad record must not kill the batch: wrap per-item processing so the loop continues |
| Quarantine queue | Failed items go to a queue (SharePoint list, Dataverse table, folder) with reason + evidence |
| Retry policy | System errors: N retries with backoff; business errors: zero retries |
| Escalation | Notifications (Teams/email) with run link, screenshot, item ID |
| Recovery | Bots must be re-runnable: skip already-processed items (idempotency keys) |
Example — Item-level isolation pattern
For each Row in WorkItems
On block error 'ItemGuard' → run subflow LogItemFailure, continue at end of block
Run subflow ProcessItem
Run subflow MarkItemComplete
End block
End
Summary
Design for partial failure: classify, isolate, quarantine, notify, and make reruns safe. This is what separates demo flows from production bots.
Part III — Data, Files, and Documents
21. Working with Files
Overview
The File action group covers the full lifecycle: If file exists, Copy, Move, Delete, Rename, Read text from file, Write text to file, Get file path part, Get temporary file, Convert file encoding, and archive actions (Zip/Unzip under Compression).
Key Actions Table
| Action | Notes |
|---|---|
| Copy/Move file(s) | Accepts lists of files; overwrite option |
| Rename file(s) | Patterns: set new name, add text, remove text, change extension, make sequential |
| Read text from file | Whole file or as a list (one item per line); choose encoding |
| Write text to file | Append or overwrite; creates the file if missing |
| Get file path part | Splits full path → directory, name, extension without string surgery |
| Wait for file | Blocks until a file is created/deleted — great for watching drop folders |
Example — Timestamped log append
Get current date and time → CurrentDateTime
Convert datetime to text (format: yyyy-MM-dd HH:mm:ss) → Timestamp
Write text to file: C:\Bot\Logs\run.log | Text: [%Timestamp%] Processed %Count% items | Append
Tip
Prefer file properties (
%File.NameWithoutExtension%,%File.Directory%) over regex/substring gymnastics on paths.
Summary
File actions are list-friendly and property-rich — lean on them instead of manual path string manipulation.
22. Working with Folders
Overview
Folder actions: If folder exists, Create/Delete/Empty/Copy/Move/Rename folder, Get files in folder, Get subfolders in folder, Get special folder.
Example — Archive processed files by month
Get special folder (Documents) → DocsPath
Get files in folder: %InputFolder%, filter *.pdf, include subfolders: off → PdfFiles
For each File in PdfFiles
Convert datetime to text (%File.LastModified%, 'yyyy-MM') → MonthFolder
Create folder: %ArchiveRoot%\%MonthFolder% (If folder exists — ignore)
Move file: %File% → %ArchiveRoot%\%MonthFolder%
End
Get files in folder supports wildcards (*.xlsx, report_??.csv), subfolder recursion, and sorting (by name, size, dates) — sort at retrieval instead of sorting lists later.
Warning
Empty folder and Delete folder are irreversible and don't use the Recycle Bin. Guard them with an If-folder-exists plus a path sanity check (never run deletes against a variable that could be empty —
Delete %Root%\%Sub%with both empty deletes from the current directory).
Summary
Get-files-in-folder + For-each is the standard batch intake pattern; always guard destructive folder actions.
23. Excel Automation
Overview
Excel is PAD's most-used integration. Two approaches exist:
| Approach | Actions | Requires Excel installed? | Speed |
|---|---|---|---|
| Classic Excel actions | Launch Excel, Read/Write worksheet, etc. (COM automation) | Yes | Slower; visible instance possible |
| Office Scripts / Graph via cloud flow | Handled in the cloud portion | No (cloud) | For files in OneDrive/SharePoint |
This chapter covers the classic actions — the standard for local/legacy files.
Core Action Set
| Action | Purpose |
|---|---|
| Launch Excel | New or open file; visible on/off → ExcelInstance |
| Attach to running Excel | Bind to an already-open workbook |
| Read from Excel worksheet | Single cell, range, all available values; "first line contains headers" → datatable |
| Write to Excel worksheet | Cell or range from a value/datatable |
| Get first free column/row | Find the append position |
| Set active Excel worksheet / Add worksheet | Sheet management |
| Run Excel macro | Execute VBA in macro-enabled workbooks |
| Save / Save as / Close Excel | Persistence; choose format |
Workflow Diagram
flowchart LR
A[Launch Excel<br>Invoices.xlsx] --> B[Read range<br>headers=true]
B --> C[Datatable in memory]
C --> D[For each row:<br>business logic]
D --> E[Build results datatable]
E --> F[Write results<br>to Report sheet]
F --> G[Save & Close Excel]
Step-by-Step: Summarize sales by writing back a status column
- Launch Excel → open
Sales.xlsx, visible: Off. - Read from Excel worksheet → All available values, first line = headers →
SalesTable. - Set variable
RowIndex = 2(row 1 is headers). - For each
RowinSalesTable:- If
%Row['Amount']% > 5000→ Write to Excel worksheet: valueHIGH, columnE, row%RowIndex%. - Set
RowIndex = %RowIndex + 1%.
- If
- Save Excel → Close Excel instance.
Best Practices
- Read/write ranges and datatables, never cell-by-cell loops (performance).
- Always Close Excel in a cleanup/finally path — orphaned
EXCEL.EXEprocesses are the #1 cause of "file locked" failures on the next run. Add a Terminate process (excel) fallback in your error subflow for unattended bots. - Keep visible: Off for unattended speed; On while debugging.
- For .xlsb/.xlsm with heavy logic, consider Run Excel macro to push work into VBA.
Troubleshooting
| Issue | Fix |
|---|---|
| "File is locked" | Previous run left EXCEL.EXE alive → terminate in error handler |
| Numbers read as text | Convert text to number after reading |
| Dates read as serial numbers | Convert with datetime actions or format cells in template |
| Slow with 50k+ rows | Read once as datatable; avoid per-cell writes; consider CSV instead |
Summary
Datatable-in, datatable-out, and always close the instance. Treat Excel as a data source, not a UI to click through.
24. PDF Automation
Overview
PDF actions (no Adobe required):
| Action | Purpose |
|---|---|
| Extract text from PDF | All pages or a range → text variable |
| Extract tables from PDF | Returns detected tables as datatables |
| Extract images from PDF | Save embedded images |
| Extract PDF file pages to new PDF | Split |
| Merge PDF files | Combine a list of PDFs, in order |
Example — Split a 100-page statement into per-page files
For each with Loop from 1 to %TotalPages%
Extract PDF file pages: pages %LoopIndex% → C:\Out\page_%LoopIndex%.pdf
End
Note
Text extraction works on digitally generated PDFs. Scanned PDFs are images — use OCR (chapter 38) or AI Builder document processing (chapter 39) instead.
Common Mistakes
- Expecting perfect table structure from "Extract tables" on complex layouts — validate column counts before trusting rows.
- Merging with an unsorted file list — sort Get files in folder by name first.
Summary
PAD handles read/split/merge natively; scans need OCR/AI Builder; heavy PDF creation belongs in Word/print-to-PDF or scripting.
25. Word Automation
Overview
Modern PAD versions include a Word action group: Launch Word, Attach to running Word, Read from Word document, Find and replace words in Word document, Insert image in Word document, Save Word, Close Word.
Example — Template-based letter generation
For each Row in CustomersTable
Launch Word: open C:\Templates\OfferLetter.docx → WordInstance
Find and replace: '<<Name>>' → %Row['Name']%
Find and replace: '<<Offer>>' → %Row['OfferAmount']%
Save Word as: C:\Out\Offer_%Row['Name']%.docx (or PDF format)
Close Word instance
End
Tip
"Save as" supports PDF output — this is the simplest reliable PDF-generation pattern in PAD.
Summary
Word actions turn .docx templates + find/replace into a document factory, with free PDF export via Save-as.
26. CSV Automation
Overview
Two actions do the heavy lifting:
- Read from CSV file → datatable (options: delimiter, encoding, first line as headers, trim fields).
- Write to CSV file → from a datatable (choose delimiter, append or overwrite).
Example — CSV → filter → CSV
Read from CSV: input.csv (headers, UTF-8) → DataTable
Create new datatable (same columns) → OutTable
For each Row in DataTable
If %Row['Country']% = 'India' then
Insert row into datatable: OutTable ← %Row%
End
End
Write to CSV: OutTable → india_only.csv
Warning
Regional settings bite here: many European exports use
;as delimiter and,as decimal separator. Set the delimiter explicitly and convert numerics with the right culture.
Summary
CSV round-trips through datatables. Set delimiter + encoding explicitly and CSVs become the fastest tabular format in PAD — no Excel dependency at all.
27. JSON Handling
Overview
- Convert JSON to custom object — parse JSON text into a navigable object:
%Obj['order']['items'][0]['sku']%. - Convert custom object to JSON — serialize for HTTP bodies, logs, or cloud flow outputs.
Example — Consume a REST response
Invoke web service (GET https://api.example.com/orders/123) → WebServiceResponse
Convert JSON to custom object: %WebServiceResponse% → Order
Set variable Total = %Order['totals']['grand']%
For each Item in %Order['items']%
Write text to file: %Item['sku']% - %Item['qty']% (append)
End
Lists inside JSON become PAD lists, iterable with For each. Missing keys raise errors — guard with On-error or check %Obj% contains key patterns via conditions.
Summary
JSON ↔︎ custom object conversion makes PAD a first-class REST client and a clean way to pass structured data to/from cloud flows.
28. XML Handling
Overview
XML action group: Read XML from file, Write XML to file, Get XML element value / attribute, Set XML element value, Insert/Delete XML element, and XPath-based queries.
Example
Read XML from file: config.xml → XmlDoc
Get XML element value: XPath //settings/retryCount → RetryCount
Set XML element value: //settings/lastRun ← %CurrentDateTime%
Write XML to file: config.xml
Tip
Learn just enough XPath:
//node,/root/child,//node[@attr='x']covers most enterprise XML (invoices, configs, SOAP responses).
Summary
XPath in, values out. For SOAP services, pair XML actions with Invoke SOAP web service.
29. Clipboard Operations
Overview
Actions: Get clipboard text, Set clipboard text, Clear clipboard.
Clipboard is the escape hatch for stubborn legacy apps: when you can't read a field via UI automation, select-all + copy (Send keys Ctrl+A, Ctrl+C) then Get clipboard text.
Warning
The clipboard is shared machine state. On attended machines a user can overwrite it mid-run; in RDP sessions clipboard sync can interfere. Read it immediately after setting it, and never park secrets in the clipboard.
Summary
Powerful last resort for data extraction from hostile UIs — use immediately-after-copy and clear when done.
30. Date & Time
Overview
| Action | Purpose |
|---|---|
| Get current date and time | Now, or today (date only) → datetime |
| Add to datetime | ± seconds/minutes/hours/days/months/years |
| Subtract dates | Difference in chosen unit |
| Convert datetime to text | .NET format strings: yyyy-MM-dd, dd-MMM-yyyy HH:mm |
| Convert text to datetime | Parse with expected format/culture |
Common Format Tokens
| Token | Meaning | Example |
|---|---|---|
yyyy |
4-digit year | 2026 |
MM / MMM |
Month number / abbrev | 07 / Jul |
dd |
Day | 20 |
HH / hh tt |
24h / 12h + AM-PM | 14 / 02 PM |
mm, ss |
Minutes, seconds | 05, 09 |
Example — "Last business day" guard
Get current date and time → Today
Convert datetime to text (dddd) → DayName
If %DayName% = 'Saturday' OR %DayName% = 'Sunday' → Stop flow (success, nothing to do)
Warning
MMis months,mmis minutes. Reversing them is the most common date bug in PAD flows — and it only shows up when filenames sort strangely.
Summary
Datetime math via Add/Subtract, formatting via .NET tokens, and always parse text dates with an explicit format + culture.
31. Text Manipulation
Overview
The Text group is large; the ones you'll use daily:
| Action | Use |
|---|---|
| Split text | Delimiter → list (e.g., lines, CSV cells) |
| Join text | List → single string with separator |
| Get subtext | Substring by position/length |
| Crop text | Text between two markers ("before X and after Y") — invaluable for scraping |
| Replace text | Literal or regex replace |
| Trim text | Whitespace or specific chars |
| Change text case | UPPER/lower/Title |
| Pad text | Fixed-width output |
| Parse text | Find position / regex match (chapter 32) |
| Create random text | Test data, temp names |
Example — Extract order ID from an email subject
Subject: [Order #A-10293] Shipping confirmation
Crop text: get text between '[Order #' and ']' → OrderId → A-10293
Summary
Crop text and Split text solve 80% of extraction jobs without regex; reach for regex only when patterns vary.
32. Regular Expressions
Overview
Regex appears inside Parse text (Is regular expression: On), Replace text, and text-condition operators. PAD uses the .NET regex engine.
Pocket Reference
| Pattern | Matches |
|---|---|
\d+ |
One or more digits |
\w+ |
Word characters |
[A-Z]{2}\d{4} |
e.g. AB1234 |
\d{2}[-/]\d{2}[-/]\d{4} |
Dates like 20-07-2026 |
(?<=Total:\s)\d+\.\d{2} |
Amount after "Total: " (lookbehind) |
^\S+@\S+\.\S+$ |
Rough email shape |
Example — Pull all invoice numbers from a PDF's text
Extract text from PDF → PdfText
Parse text: %PdfText%, pattern INV-\d{6}, first occurrence only: Off → Matches (list)
For each M in Matches → process %M%
Tip
Turn on "First occurrence only: Off" to get all matches as a list — the single most useful regex switch in PAD.
Summary
.NET regex + Parse text = structured data out of unstructured text. Keep patterns commented (action comments) — future-you will thank you.
Part IV — Application, Web, and UI Automation
33. Email Automation
Overview
The generic Email actions speak standard protocols — no Outlook required:
| Action | Protocol | Purpose |
|---|---|---|
| Retrieve email messages | IMAP | Read/filter inbox, download attachments |
| Process email messages | IMAP | Mark read, move, delete retrieved items |
| Send email message | SMTP | Send with attachments, CC/BCC, HTML body |
Example — Watch a mailbox for reports
Retrieve email messages: server imap.company.com, folder Inbox,
unread only, subject contains 'Daily Report', save attachments to C:\Drop → Emails
For each Mail in Emails
Process email: mark as read, move to 'Processed'
End
Warning
Modern Exchange Online restricts basic auth — for M365 mailboxes prefer Outlook actions (chapter 34) or handle mail in the cloud flow with the Office 365 Outlook connector, passing attachments to the desktop flow. Use IMAP/SMTP mainly for non-M365 systems.
Summary
IMAP/SMTP actions are protocol-level workhorses for generic mail systems; for Microsoft 365, do email in the cloud flow or via Outlook actions.
34. Outlook Automation
Overview
Outlook actions drive the installed desktop Outlook client via COM:
| Action | Purpose |
|---|---|
| Launch Outlook / Close Outlook | Get an OutlookInstance |
| Retrieve email messages from Outlook | Account, folder, filters (unread, from, subject contains), save attachments |
| Send email message through Outlook | Sends as the signed-in profile |
| Process email messages in Outlook | Move/delete/mark |
| Save Outlook email messages | Export .msg files |
Example — Triage + reply
Launch Outlook → OutlookInstance
Retrieve emails: folder 'Inbox\Invoices', unread only, attachments to C:\Invoices → Mails
For each M in Mails
Send email through Outlook: To %M.From%, Subject 'RE: %M.Subject%',
Body 'Received, processing within 24h.'
Process email: move to 'Inbox\Invoices\Ack'
End
Best Practices
- Outlook must be configured with a profile for the bot's Windows account (critical on unattended machines).
- Folder paths are relative to the account:
Inbox\Sub— verify exact names. - Security prompts ("A program is trying to send...") on old Office builds need admin-managed trust settings.
Summary
Outlook actions = full desktop-client automation. Ensure profile setup on the bot machine, and prefer cloud-flow email when a mailbox is in Exchange Online and no client interaction is needed.
35. Browser Automation
Overview
PAD automates Edge, Chrome, Firefox (via extensions) and an internal "Automation browser" (IE-engine legacy). Actions:
| Category | Actions |
|---|---|
| Session | Launch new Edge/Chrome/Firefox, Attach to running browser, Close web browser |
| Navigation | Go to web page, Click link (navigate), Refresh |
| Interaction | Click element, Populate text field, Set drop-down value, Set checkbox, Press button, Hover |
| Reading | Get details of web page / element, Extract data from web page, Take screenshot |
| Waiting | Wait for web page content, If web page contains |
Elements are located by selectors (CSS/attribute-based) captured into the UI elements pane.
Workflow Diagram
flowchart TD
L[Launch Edge → Browser] --> N[Go to login page]
N --> F[Populate username/password<br>from credential store]
F --> B[Press 'Sign in']
B --> W{Wait for dashboard<br>element visible?}
W -->|timeout| E[Throw system exception]
W -->|found| X[Extract data from web page]
X --> C[Close browser]
Step-by-Step: Robust login pattern
- Launch new Microsoft Edge → URL, window state Maximized →
Browser. - Populate text field: username element ←
%Username%. - Populate text field: password ←
%Password%(sensitive variable from CyberArk/credential input). - Press button: Sign in.
- Wait for web page content: element
#dashboardvisible, timeout 30s. On error → throw.
Selector Hygiene
- Prefer stable attributes:
id,name,data-*over auto-generated classes (css-1x2y3z). - Edit selectors in the UI elements pane: replace brittle segments with
*wildcards or attribute conditions. - One shared UI element repository per app (via a dedicated "selectors" flow you copy from) keeps maintenance in one place.
Common Mistakes
- Fixed Wait 5 seconds everywhere instead of Wait for element — slow and flaky.
- Automating a visible browser while a user is using the machine (attended chaos) — run on a separate session/machine.
- Ignoring iframes — elements inside frames need the frame in the selector path.
Summary
Launch → wait for elements → interact via selectors → extract → close. Explicit waits and stable selectors are 90% of browser-automation reliability.
36. Web Scraping
Overview
Extract data from web page is PAD's scraping engine. While it's open, you interact with a live extraction wizard: click one value → it infers the pattern; click a second → it detects the list/table; it can auto-detect pagination and extract across pages.
Extraction targets: single value, list, table (→ datatable), or entire HTML.
Step-by-Step: Scrape a product catalog
- Launch new Chrome → catalog URL.
- Add Extract data from web page; with the dialog open, switch to the browser.
- Right-click first product name → Extract element value → Text. Right-click second product name → PAD recognizes the repeating list.
- Add price and rating the same way → columns form a table preview.
- Set pager element (Next button) → "extract data from multiple pages".
- Store to Excel spreadsheet (auto-opens result) or variable →
DataFromWebPage. - Post-process the datatable (clean currency symbols → numbers), then write to CSV.
Note
Respect the target site's terms of service and robots policies, add delays between pages, and never scrape personal data you're not authorized to process. For sites with APIs, use the API.
Troubleshooting
| Issue | Fix |
|---|---|
| Empty results on dynamic sites | Add Wait for web page content before extraction (JS-rendered content) |
| Structure breaks on page 2 | Re-capture with pagination enabled; verify pager selector |
| Anti-bot walls / CAPTCHAs | That's a signal to stop and seek an API/permission — don't automate around them |
Summary
The extraction wizard turns repeating page structures into datatables, pagination included. Scrape ethically and prefer APIs where offered.
37. UI Automation
Overview
UI automation actions drive any Windows application (WPF, WinForms, Win32, Java via bridge, SAP GUI with scripting enabled) through the accessibility tree:
| Category | Actions |
|---|---|
| Windows | Get window, Focus window, Set window state, Close window, Wait for window |
| Elements | Click UI element, Populate text field, Select menu option, Select radio/checkbox, Expand/collapse tree node, Press button |
| Data | Get details of UI element / window, Extract data from window (tables/lists → datatable) |
| Waiting | Wait for UI element (appear/disappear) |
Elements are captured with Ctrl+click in capture mode and stored in the UI elements pane as a hierarchy of selectors (window → pane → control), each with editable attributes and orderables.
UI Automation Workflow
flowchart LR
A[Run/attach application] --> B[Wait for main window]
B --> C[Focus window]
C --> D[Interact: click / populate<br>via captured UI elements]
D --> E[Extract data from window]
E --> F[Validate expected state<br>Wait for confirmation element]
F --> G[Close app cleanly]
Best Practices
- Focus the window before sending interactions; background windows behave inconsistently.
- Anchor selectors on Automation IDs / names, not screen order (
Instance 3breaks when layout shifts). - Wrap every "screen" in a subflow:
Screen_Login,Screen_NewOrder— screens are your natural modular boundary. - Prefer UI element actions over keyboard/mouse simulation; drop to send-keys only when the tree exposes nothing.
Troubleshooting
| Issue | Fix |
|---|---|
| Element not found at runtime | Window title changed (version/user in title) → wildcard the title attribute |
| Works attended, fails unattended | Screen resolution/DPI differs in the bot session → fix session resolution in machine settings |
| Java/SAP app invisible to capture | Install Java bridge files / enable SAP GUI scripting (client + server side) |
Summary
UI automation is PAD's superpower for legacy apps: capture elements, wait explicitly, structure by screen, and keep selectors resilient.
38. OCR
Overview
OCR actions read text from images and screen regions:
| Action | Purpose |
|---|---|
| Extract text with OCR | From entire screen, foreground window, region, or image file |
| If text on screen (OCR) / Wait for text on screen (OCR) | Vision-based conditions for apps with unreadable UIs (Citrix, VMs) |
Engines: Windows OCR (fast, language-pack based) and Tesseract (open-source, more configurable). Both support language selection; accuracy depends heavily on resolution and contrast.
Example — Read a total from a Citrix window region
Wait for text on screen (OCR): 'Grand Total' in foreground window, timeout 30s
Extract text with OCR: region (x=850,y=420,w=200,h=40) → OcrText
Parse text: \d+\.\d{2} → Amount
Tip
Boost OCR accuracy: maximize the window, standardize resolution/DPI, scale the image up 2×, and narrow the OCR region to just the field you need.
Summary
OCR is the tool of last resort for pixel-only environments (Citrix/RDP) and scanned images — combine with regex to structure the output, and validate aggressively.
39. AI Builder Integration
Overview
AI Builder brings trained AI models into the Power Platform: document processing (invoices/receipts), text recognition, classification, entity extraction, GPT-style prompts. Integration patterns with PAD:
| Pattern | How |
|---|---|
| Cloud-first (recommended) | Cloud flow runs AI Builder (e.g., Extract information from invoices), passes structured fields as inputs to the desktop flow |
| From PAD | AI Builder / "Create text with GPT" style actions in newer PAD versions, or call the model via HTTP/cloud flow |
Example — Intelligent invoice entry (hybrid)
- Cloud flow trigger: invoice PDF arrives in a mailbox.
- AI Builder invoice processing model extracts VendorName, InvoiceNumber, Total, LineItems.
- Cloud flow calls the desktop flow with those values as inputs.
- Desktop flow types them into the legacy ERP UI and returns the ERP document number.
Note
AI Builder consumes credits (included allowances with Premium; add-ons for scale). Model accuracy improves with training on your own document samples.
Summary
Let AI Builder do the understanding in the cloud; let PAD do the typing on the desktop. This split is the modern intelligent-automation architecture.
40. Database Automation
Overview
The Database action group uses ODBC/OLE DB connection strings:
| Action | Purpose |
|---|---|
| Open SQL connection | Connection string → SQLConnection |
| Execute SQL statement | SELECT → datatable; INSERT/UPDATE/DELETE → affected rows |
| Close SQL connection | Always, in cleanup |
Works with SQL Server, Access, Oracle, MySQL, PostgreSQL, Excel-as-database — anything with an ODBC/OLE DB provider installed.
Example connection strings
SQL Server (integrated): Provider=SQLOLEDB;Data Source=SRV01;Initial Catalog=Ops;Integrated Security=SSPI;
Access: Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\db\ops.accdb;
Warning
Never concatenate raw user/scraped text into SQL (
WHERE name = '%Input%') — SQL injection applies to bots too. Sanitize inputs, constrain to expected patterns, and use least-privilege database accounts.
Summary
Open → Execute (datatable back) → Close. Databases are almost always faster and safer than automating a data-entry UI — check for DB access before building screen automation.
41. SQL Server Integration
Overview
Practical patterns for the most common enterprise DB:
| Need | Pattern |
|---|---|
| Auth | Prefer Integrated Security=SSPI (bot's Windows account) over SQL logins; if SQL auth, credentials come from a vault |
| Bulk read | SELECT with explicit column list, filters server-side (never SELECT * then filter in PAD) |
| Bulk write | Batch INSERTs in one Execute (multi-row INSERT ... VALUES (...),(...)), or stage via CSV + BULK INSERT for large volumes |
| Status/work queue | A WorkItems table (Id, Payload, Status, LockedBy, Attempts) makes bots restartable and horizontally scalable |
| Stored procedures | EXEC dbo.usp_PostInvoice @No='%InvNo%', @Amt=%Amt% — encapsulate logic DB-side |
Example — Queue consumer
Open SQL connection
Loop condition: While %True%
Execute SQL: UPDATE TOP(1) WorkItems SET Status='Processing', LockedBy=HOST_NAME()
OUTPUT inserted.* WHERE Status='New' → Item
If %Item.RowsCount% = 0 → Exit loop
Run subflow ProcessItem (On block error → mark Failed)
Execute SQL: UPDATE WorkItems SET Status='Done' WHERE Id=%Item[0]['Id']%
End
Close SQL connection
Summary
SQL Server + a work-queue table is the backbone of scalable, restartable unattended automation.
42. REST API Calls
Overview
Invoke web service is PAD's REST client: method (GET/POST/PUT/PATCH/DELETE), URL, headers, body, timeout → status code + response text.
Step-by-Step: Authenticated POST
- Invoke web service:
- URL:
https://api.example.com/v1/orders - Method: POST
- Custom headers:
Authorization: Bearer %AccessToken% Content-Type: application/json - Request body:
{"customer":"%CustId%","amount":%Amount%}
- URL:
- Check
%WebServiceResponseHeaders%/ status: If%StatusCode% <> 201→ throw with%WebServiceResponse%. - Convert JSON to custom object → read the created order ID.
Tip
For Entra-protected APIs (Graph, Dataverse) prefer calling them from the cloud flow with a connector (managed auth). From PAD, use OAuth client-credentials via a token endpoint call, cache the token in a variable, and mark it sensitive.
Summary
Invoke web service + JSON conversion turns PAD into an integration client; always branch on status codes, never assume 200.
43. HTTP Requests
Overview
Beyond REST APIs:
| Action | Use |
|---|---|
| Download from web | GET a file (reports, installers) straight to disk |
| Invoke web service | Any raw HTTP, including form posts (application/x-www-form-urlencoded) |
| Invoke SOAP web service | Legacy SOAP with envelope body |
Example — Download the daily report
Download from web: https://portal.example.com/reports/daily.csv
→ destination C:\Drop\daily_%Today%.csv, timeout 120s
If file exists (that path) AND size > 0 → continue, else throw
Warning
Always set explicit timeouts and validate the downloaded artifact (exists, non-zero, expected header row). A 200-OK HTML error page saved as ".csv" will poison downstream steps silently.
Summary
Download-from-web for files, Invoke-web-service for everything else, and validate every response like it's hostile.
Part V — Scripting and System Integration
44. PowerShell Integration
Overview
Run PowerShell script executes inline PowerShell and returns PowershellOutput (stdout), errors, and exit code. This is the professional's escape hatch: anything PAD lacks an action for, PowerShell can do — AD lookups, Graph calls, registry surgery, module-based admin (Exchange, SharePoint, M365).
Example — Check AD account status
$u = Get-ADUser -Identity '%SamAccountName%' -Properties Enabled, LockedOut
[pscustomobject]@{
Enabled = $u.Enabled
LockedOut = $u.LockedOut
} | ConvertTo-Json -CompressThen in PAD: Convert JSON to custom object on %PowershellOutput% → branch on %Obj['LockedOut']%.
Best Practices
- Return JSON, parse in PAD — never regex-parse formatted console output.
%Variable%substitution happens before PowerShell runs — quote substituted values ('%Path%') and beware of values containing quotes.- Keep scripts short; long logic belongs in a
.ps1invoked with parameters (versionable in Git). - The script runs as the flow's Windows session user — module availability and permissions follow that account.
Summary
PowerShell is PAD's power extension. JSON in/out, parameterize carefully, and mind the execution identity.
45. CMD Integration
Overview
Two styles:
| Action | Use |
|---|---|
| Run DOS command | Fire one command/batch, wait, capture output + exit code |
| CMD session actions (Open CMD session, Read/Write, Wait for text, Close) | Interactive console programs that prompt for input |
Example
Run DOS command: robocopy "C:\Src" "\\NAS\Backup" /MIR /R:2 /W:5 → Output, ExitCode
If %ExitCode% > 7 → throw 'Robocopy failed: %Output%'
Note
Robocopy exit codes 0–7 mean success variants; ≥8 means failure — a classic example of why you check exit codes per tool, not
<> 0.
Summary
Run-DOS-command for fire-and-forget with exit-code checks; CMD sessions for interactive console dialogs.
46. VBScript Integration
Overview
Run VBScript exists mainly for legacy interop: old in-house scripts, classic COM automation, and environments where VBScript assets already exist.
Set fso = CreateObject("Scripting.FileSystemObject")
WScript.Echo fso.GetFile("%FilePath%").DateLastModified
Warning
Microsoft has deprecated VBScript in Windows (being phased out as a feature-on-demand). Do not build new logic in VBScript — migrate to PowerShell. Keep this action only for wrapping legacy assets during transition.
Summary
Bridge for legacy scripts only; all new scripting goes to PowerShell.
47. Python Integration
Overview
Run Python script executes IronPython (Python 2.7 syntax, .NET-based) — not your installed CPython, so no pandas/numpy/pip packages.
For real Python (CPython 3.x + libraries), invoke it via Run DOS command:
Run DOS command: "C:\Python312\python.exe" "C:\Bots\scripts\transform.py" "%InputCsv%" "%OutputCsv%"
If %ExitCode% <> 0 → throw %Output%
Have the script print JSON to stdout for structured results, or write an output file PAD picks up.
Summary
Inline action = IronPython (limited). Production pattern = call CPython via command line with args, exchange data via files/JSON/exit codes.
48. Running External Applications
Overview
| Action | Purpose |
|---|---|
| Run application | Launch exe with arguments, working folder, window style; optionally wait for completion → exit code, or continue → Process ID |
| Terminate process | Kill by name or PID (cleanup for hung apps) |
| If process / Wait for process | Existence checks and synchronization |
Example
Run application: "C:\Program Files\7-Zip\7z.exe"
arguments: a "C:\Out\archive.zip" "C:\Out\*.csv"
wait for completion → ExitCode
Tip
Every unattended flow's error handler should Terminate process for the apps it uses (excel, chrome, the ERP client). A hung leftover process is the top cause of "works once, fails every run after."
Summary
Run-with-wait + exit-code checks for CLIs; Terminate-process as standard cleanup for GUI apps.
49. Windows Automation
Overview
System-level action groups:
| Group | Highlights |
|---|---|
| Workstation | Lock workstation, take screenshot, set default printer, log off/shutdown/restart, empty recycle bin |
| System | Environment variables (ch 56), registry read/write, ping, process control |
| Windows services | Start/Stop/Pause/Resume service, If service (running/stopped) |
| Windows (UI) | All window-management actions from chapter 37 |
Example — Self-healing service dependency
If service 'Spooler' is not running →
Start service 'Spooler'
Wait for service 'Spooler' to be running (timeout 60s)
Warning
Registry writes and service control need appropriate rights and can destabilize a machine — restrict these flows to admin-reviewed, unattended service accounts with change-management sign-off.
Summary
PAD doubles as a lightweight IT-ops tool: services, registry, screenshots, and power actions — with great power etc.
50. Keyboard Automation
Overview
Send keys types text and key chords into the focused window.
| Syntax | Meaning |
|---|---|
Hello |
Literal text |
{Enter} {Tab} {Esc} {F5} |
Special keys |
{Control}({S}) |
Ctrl+S chord |
{Alt}({F4}) |
Alt+F4 |
| Delay between keystrokes | Setting for slow legacy apps |
Best Practices
- Focus the target window first (Focus window action) — send-keys goes wherever focus is, which on an attended machine might be the user's email.
- Prefer Populate text field (element-targeted) whenever the element is capturable; send-keys is the fallback.
- For text with special characters, use the "send text as hardware keys / individual keystrokes" options to avoid
{ }interpretation issues.
Summary
Send-keys is precise but focus-fragile: focus, type, verify. Element-based input beats it whenever available.
51. Mouse Automation
Overview
| Action | Use |
|---|---|
| Move mouse / Move mouse to image / to text (OCR) | Position by coordinates, image match, or OCR hit |
| Send mouse click | Left/right/double/middle at current or given position |
| Select text with mouse (drag) | Click-drag selections |
Coordinates can be absolute (screen) or relative to a window — always prefer window-relative, since absolute coordinates break with resolution changes.
Warning
Coordinate clicking is the most brittle technique in RPA. Use it only when element capture, image match, and OCR all fail — and pin the session resolution (chapter 69) if you must.
Summary
Mouse simulation is the last rung of the reliability ladder: element > image > OCR > coordinates.
52. Screen Recording
Overview
Two related capabilities:
- The Recorder (toolbar) — watches you work and generates actions (both web and desktop steps auto-detected). Best used to scaffold a flow you then refine: rename variables, replace fixed waits, harden selectors.
- Run-time capture — Take screenshot action (screen/window → file or clipboard) for evidence and error forensics; unattended runs can also be reviewed via run logs and (in supported setups) session video/screenshot capture in the portal.
Tip
Recorder output is a first draft, never production code. Expect to replace ~30% of recorded steps with waits, conditions, and error handling.
Summary
Record to scaffold, screenshot to prove. Neither replaces deliberate flow design.
53. Image Recognition
Overview
Image-based actions match saved image snippets (Images pane) against the live screen:
| Action | Use |
|---|---|
| Move mouse to image / click | Interact where the image is found |
| Wait for image | Synchronize on visual state |
| If image (exists / doesn't exist) | Branch on visual state |
| Find image(s) on screen | Get coordinates for later use |
A tolerance setting handles minor rendering differences; capture tightly-cropped, distinctive snippets (a unique button, not a generic gray rectangle).
When to Use
Citrix/RDP streams, apps with no accessibility tree, or canvas-drawn UIs — the same territory as OCR, but for interaction rather than reading.
Common Mistakes
- Capturing images at one resolution/theme and running at another (dark mode breaks matches).
- Over-large captures that match multiple screen areas — crop tight and unique.
Summary
Image matching gives eyes to interactions where selectors can't reach — keep captures small, distinctive, and environment-stable.
54. Computer Vision
Overview
"Computer vision" in the PAD context is the umbrella over its visual capabilities and where they're heading:
| Capability | Underlying tech |
|---|---|
| OCR text reading & text-based conditions | Windows OCR / Tesseract engines |
| Image matching | Template matching with tolerance |
| AI Builder document/field understanding | Trained deep-learning models (cloud) |
| Copilot-era "describe intent" authoring & AI-assisted element detection | LLM/vision assistance in the designer (evolving rapidly — check current docs for feature state) |
The design principle stays constant: semantic access first (UI tree, DOM), visual access second (image/OCR), and AI understanding for unstructured content.
Summary
Vision features close the gap for pixel-only surfaces and unstructured documents; treat AI-assisted authoring capabilities as accelerators whose exact feature set you verify against current Microsoft documentation.
Part VI — Professional Development Practices
55. Credentials Management
Overview
Never hardcode secrets. Options, weakest to strongest:
| Option | Notes |
|---|---|
| Hardcoded in actions | ❌ Never — visible to anyone with edit rights, leaks via copy/paste |
| Sensitive input variables | OK for attended prompts; value never persisted |
| Windows Credential Manager (via PowerShell/CredentialManager module) | Machine-local; decent for single-machine bots |
| Azure Key Vault (via cloud flow or REST) | Central, audited, rotatable — cloud flow fetches secret, passes as sensitive input |
| CyberArk integration (PAD's built-in "Get credential" style inputs in enterprise setups) | Enterprise PAM: check-in/check-out, rotation, session isolation |
Warning
Avoid hardcoding credentials — in actions, in scripts, in connection strings, or in Excel "config" files. Assume every flow definition will be read by someone else someday.
Practical Pattern (Key Vault + hybrid flow)
- Cloud flow: Azure Key Vault – Get secret (secure input/output ON).
- Pass to desktop flow as a sensitive text input.
- Desktop flow uses it in Populate-text-field; never logs it; never sets it to clipboard.
Summary
Secrets live in a vault, travel as sensitive variables, and never appear in definitions, logs, or clipboards.
56. Environment Variables
Overview
Two distinct concepts share this name:
- Windows environment variables — PAD actions Get/Set environment variable (
%PATH%,%TEMP%, custom machine/user vars). Useful for machine-specific config (install paths). - Power Platform environment variables — Dataverse-backed configuration values that change per environment (Dev/Test/Prod) and travel with solutions. Cloud flows read them natively; desktop flows receive them as inputs from the calling cloud flow.
Recommended Config Strategy
| Config type | Where |
|---|---|
| Per-environment URLs, folder paths, mailbox names | Power Platform environment variables → passed as desktop-flow inputs |
| Machine-specific paths | Windows env vars or a machine-local config file |
| Secrets | Vault (chapter 55) — never in either kind of environment variable |
Summary
Externalize all configuration; use Power Platform environment variables for ALM-friendly per-environment values and pass them into desktop flows as inputs.
57. Logging
Overview
Three logging layers:
| Layer | What you get | Where |
|---|---|---|
| Run history (automatic) | Start/end, status, error, action-level details | Power Automate portal → desktop flow → Runs; stored in Dataverse |
| Custom file/DB logging (you build) | Business events: items processed, decisions, durations | Log file, SQL table, SharePoint list |
| Telemetry (optional) | Centralized ops view | Application Insights / Log Analytics via HTTP or scripts |
A Minimal Logging Subflow
Log(Level, Message) subflow:
Convert datetime to text %CurrentDateTime% → Ts
Write text to file C:\Bot\Logs\%FlowName%_%Today%.log
[%Ts%] [%Level%] [%MachineName%] %Message% (append)
Call it everywhere: Run subflow Log('INFO','Posted invoice %InvNo%').
Best Practices
- Log item IDs and outcomes, not payload contents (privacy + size).
- One log line at start (inputs summary) and end (status + counts) minimum.
- Rotate: date-stamped filenames; a cleanup flow deletes logs older than N days.
- Never log sensitive variables — marking them sensitive masks them in PAD logs; keep them out of your custom logs by discipline.
Summary
Portal run history for ops, custom structured logs for business truth, and strict hygiene about what never gets logged.
58. Debugging
Overview
Designer debugging toolkit:
| Tool | Use |
|---|---|
| Run (F5) | Full run with live action highlighting |
| Run next action (F10) | Step one action at a time |
| Run from here | Right-click an action → start mid-flow |
| Breakpoints (F6) | Pause at a line (chapter 59) |
| Variables pane | Live values; expand datatables/objects; edit values while paused |
| Errors pane | Design-time (missing params) + runtime errors with action line |
| Disable action / region | Temporarily remove steps from execution |
Debugging Discipline
- Reproduce with a small dataset (2 rows, 1 file).
- Breakpoint before the failing action; inspect exact variable values — most "selector" bugs are actually data bugs (trailing space, wrong type).
- Step (F10) through the failure; watch the target app.
- Fix, then rerun the whole flow — mid-flow fixes hide state assumptions.
Summary
F5/F10/F6 + the variables pane solve most problems; debug with tiny datasets and always finish with a clean full run.
59. Breakpoints
Overview
Click the margin next to an action (or F6) → red dot → execution pauses before that action. While paused you can inspect and even modify variables, then continue (F5) or step (F10).
Patterns:
- Loop debugging: breakpoint inside the loop + a condition action before it (
If %Row['Id']% = 'PROBLEM-42'→ Comment action with breakpoint) simulates conditional breakpoints. - Pre-destructive checkpoint: breakpoint before any delete/submit while testing against real systems.
Note
Breakpoints are a designer feature; they don't exist in console/unattended runs — remove reliance on them for timing (if a flow only works when paused, you're missing a Wait-for condition).
Summary
Pause-inspect-modify-continue. If a breakpoint "fixes" the flow, you've found a race condition to solve with explicit waits.
60. Performance Optimization
Overview
| Bottleneck | Optimization |
|---|---|
| Excel cell-by-cell I/O | Read/write whole ranges as datatables |
Fixed waits (Wait 5) |
Replace with Wait-for-element/window/file (event-driven) |
| UI data entry for bulk data | Switch to DB/API/file import where possible |
| Visible applications | Run Excel/browsers non-visible where supported |
| Huge loops in PAD | Push set-based work to SQL/PowerShell/Python; PAD orchestrates |
| Repeated app launches | Launch once, reuse the instance across the loop |
| Selector searches on giant pages | Narrow with more specific parent anchors |
| Sequential machine use | Parallelize across a machine group (chapter 71) |
Measuring
Wrap phases with datetime captures:
Get current date and time → T0
... phase ...
Get current date and time → T1
Subtract dates %T1% - %T0% in seconds → PhaseSecs
Run subflow Log('PERF','Extraction took %PhaseSecs%s')
Portal run history also shows per-run durations — baseline before optimizing.
Summary
Batch I/O, event-driven waits, offload set-based work, reuse instances, and scale out with machine groups. Measure first.
61. Reusable Subflows
Overview
Subflows are named tabs inside a desktop flow — callable with Run subflow, sharing the flow's variables. They're your functions:
- Decompose by responsibility:
Init,ReadWork,ProcessItem,Screen_Login,HandleError,Cleanup. Mainshould read like a table of contents — mostly Run-subflow calls.
Cross-flow reuse — Run desktop flow action calls another desktop flow with its own input/output contract. This is how you build a shared library: Lib_Login_SAP, Lib_SendNotification, Lib_ArchiveFile as standalone flows consumed by many processes.
Tip
Because subflows share variables (no parameters), establish a convention: a subflow documents (comment at top) which variables it expects and which it produces. For true encapsulation, promote it to a separate desktop flow with explicit inputs/outputs.
Summary
Subflows organize; child desktop flows encapsulate and reuse. Main = orchestration only.
62. Custom Functions
Overview
PAD has no user-defined function syntax; you compose "functions" from:
| Technique | When |
|---|---|
| Subflow with variable conventions | In-flow logic reuse |
| Child desktop flow with inputs/outputs | Cross-flow, true parameters |
| PowerShell/.NET script actions | Computation-heavy or missing capabilities (hashing, advanced string ops) |
| Copy-paste action templates | Team snippet library in a wiki — actions paste from clipboard text |
Example — a "function" via child flow
Fn_CleanAmount desktop flow: input RawText → trims currency symbols/whitespace, converts to number → output Amount, IsValid. Every process flow calls it instead of re-implementing cleanup.
Summary
Parameters live at the desktop-flow boundary — design small utility flows as your function library, and keep a snippet wiki for everything else.
63. Exception Framework
Overview
A reusable structure every production flow follows — PAD's equivalent of REFramework-style discipline:
flowchart TD
I[Init: config, kill stale apps,<br>validate inputs] --> G[Get work items<br>from queue/file/DB]
G --> L{Next item?}
L -->|yes| T[Try: ProcessItem<br>inside On block error]
T -->|success| M[Mark Done] --> L
T -->|BusinessException| BQ[Mark BusinessError<br>quarantine + notify] --> L
T -->|SystemException| SR{Retries left?}
SR -->|yes| RS[Reset app state] --> T
SR -->|no| SQ[Mark SystemError<br>screenshot + alert] --> L
L -->|no| C[Cleanup: close apps,<br>write summary, outputs]
C --> E[End: Status/Counts to caller]
Building Blocks in PAD Terms
| Framework part | PAD implementation |
|---|---|
| Init | Subflow: read config inputs, Terminate stale processes, create folders |
| Work queue | SQL table / SharePoint list / Excel with Status column |
| Try | On block error around ProcessItem subflow |
| Classify | ProcessItem sets ErrorType variable ('Business'/'System') before throwing (Stop flow with error / raised errors) |
| Retry | Loop with Attempts counter around the Try block; app-reset subflow between attempts |
| Evidence | Take screenshot + %LastError% details into the log on failure |
| Cleanup | Always-runs subflow (call it at end of Main AND from terminal error paths) |
| Outputs | Status, Processed, Failed, Message output variables |
Summary
Init → GetWork → (Try/Classify/Retry/Record) per item → Cleanup → Report. Copy this skeleton as your team's flow template and every bot becomes predictable.
64. Best Practices
Naming Standards
| Artifact | Convention | Example |
|---|---|---|
| Desktop flow | Dept_Process_Action |
FIN_APInvoice_Post |
| Library flow | Lib_ prefix |
Lib_SAP_Login |
| Subflow | Verb or Screen | ProcessItem, Screen_Login |
| Variables | PascalCase (+ optional type hints) | InvoiceTable, numAttempts |
| Inputs/Outputs | Clear external names + descriptions | In_SourceFolder, Out_Status |
| UI elements | App_Screen_Control | SAP_Login_UserField |
Structural Practices
- Main = orchestration only; all work in subflows.
- Config externalized (inputs / environment variables / config file) — zero hardcoded paths, URLs, mailboxes.
- Every external interaction wrapped in waits + error handling.
- Comments on any non-obvious action; a header comment block in Main (purpose, author, contract, change log).
- Idempotent runs: safe to rerun after any failure.
Data & Logging
- Datatables for bulk, explicit conversions at boundaries, sensitive marking for secrets, structured logs with item IDs.
Documentation
Minimum viable doc per flow: purpose, trigger, inputs/outputs, systems touched, credentials used, failure behavior, and a runbook line ("if it fails: X").
Summary
Consistency beats cleverness. A shared template + naming standard turns individual flows into a maintainable estate.
65. Enterprise Design Patterns
Overview
| Pattern | Problem it solves | Shape |
|---|---|---|
| Dispatcher / Performer | Decouple intake from processing; scale independently | Flow A fills a queue; Flow B(s) consume it |
| Work queue with states | Restartability, parallelism, audit | New → Processing → Done/BusinessError/SystemError |
| Orchestrator (cloud) + Worker (desktop) | Use connectors/AI where possible, UI only where needed | Chapter 5 pattern |
| Screen-object library | Selector maintenance in one place | Lib_<App>_<Screen> flows own all interactions for a screen |
| Config-driven bot | Same flow, many variants | Behavior table (Excel/Dataverse) read at Init |
| Circuit breaker | Stop hammering a down system | After N consecutive system errors → halt run, alert |
| Heartbeat | Detect silent death of long runs | Periodic log/API ping; watchdog cloud flow alerts on silence |
Dispatcher/Performer Sketch
Dispatcher (runs 06:00): read mailbox → validate → INSERT WorkItems(Status='New')
Performer (runs on 3-machine group, parallel): queue-consumer loop from chapter 41
Reporter (runs 18:00): summarize WorkItems by status → Teams adaptive card
Summary
Queues decouple, orchestrators delegate, libraries centralize selectors, config tables generalize. These five patterns cover most enterprise estates.
66. Source Control
Overview
Desktop flows live in Dataverse, not files — so source control works through solutions:
| Mechanism | How |
|---|---|
| Solutions | Add desktop flows (+ cloud flows, env variables, connection references) to a solution; export as .zip |
Power Platform CLI (pac) |
pac solution export / unpack → source-controllable XML/JSON in Git |
| Pipelines | Azure DevOps / GitHub Actions with Power Platform Build Tools automate export→unpack→commit and build→import |
| Manual snapshot (small teams) | Copy-paste all actions to a .txt in Git — crude but diff-able |
Practical Git Layout
/solutions/FIN_APAutomation/ ← unpacked solution source
/scripts/ ← .ps1 / .py invoked by flows
/docs/FIN_APInvoice_Post.md ← runbooks & design docs
/pipelines/azure-pipelines.yml
Tip
Version behavior too: keep the config workbook/table definitions and test data samples in the repo, not just the flow.
Summary
Solutions are the unit of versioning; pac CLI unpacks them into Git-friendly source; pipelines make it continuous.
67. Deployment
Overview
Environment strategy: Dev → Test → Prod, each its own Power Platform environment with its own Dataverse, machines, credentials, and DLP.
Deployment Flow
flowchart LR
DEV[Dev environment<br>build & unit test] -->|Export managed solution| TEST[Test environment<br>UAT on test machines]
TEST -->|Same artifact| PROD[Prod environment<br>machine groups + monitoring]
subgraph Per-environment values
EV[Environment variables<br>Connection references<br>Credentials]
end
EV -.configure at import.-> TEST
EV -.configure at import.-> PROD
Rules of the road:
- Export managed solutions downstream; keep unmanaged only in Dev.
- Never edit in Prod — hotfix in Dev, redeploy.
- Environment variables + connection references make the same artifact run correctly per environment.
- Pair each environment with its own machines/machine groups; a Test bot must never touch Prod systems.
- Use Power Platform Pipelines (in-product) or Azure DevOps/GitHub pipelines for gated, auditable promotion.
Summary
Managed solutions + environment variables + per-environment machines = boring, repeatable deployments. Boring is the goal.
68. Scheduling Desktop Flows
Overview
Desktop flows don't schedule themselves — a cloud flow with a Recurrence trigger schedules them:
- Cloud flow: Recurrence (e.g., weekdays 06:00, time zone set explicitly).
- Action: Run a flow built with Power Automate for desktop → pick flow, machine/machine group, run mode (unattended), inputs.
- Handle outputs: post summary, alert on failure (configure run after → "has failed" branch).
Note
Local Windows Task Scheduler can start PAD flows via console URI/CLI in edge cases, but you lose portal telemetry, queuing, and governance — the cloud-flow pattern is the supported enterprise approach (requires Premium/Process licensing per mode).
Queueing Behavior
If the machine is busy, cloud-triggered runs queue and execute in order; you can monitor and reprioritize queued runs in the portal (Monitor → Desktop flow queues).
Summary
Recurrence-triggered cloud flow → run desktop flow (unattended) → alert on failure. That's production scheduling.
69. Running Unattended Bots
Overview
Unattended = the platform signs into the machine itself (creates a session, runs, signs out). Requirements:
- Process license (or Hosted Process) per concurrent session.
- Machine registered (machine-runtime app) and, ideally, in a machine group.
- A connection with valid machine credentials (username/password the platform uses to log in).
- Windows Pro/Enterprise/Server (not Home); user must be allowed to log on; no interactive user holding the console session (or configure appropriately for multi-session).
- Screen resolution for the bot session configurable in machine settings — set it to match what selectors/images were built against.
Hardening Checklist
| Item | Why |
|---|---|
| Dedicated bot account (no MFA-interactive blockers; use excluded/conditional policies per security guidance) | Platform must complete Windows sign-in |
| Password rotation integrated with connection updates (vault-driven) | Avoid 3 a.m. auth failures |
| Auto-login disabled, machine locked when idle | Security |
| "Terminate stale processes" in Init | Clean state each run |
| Session resolution pinned | Selector/image stability |
| Watchdog alerting (failed/queued too long) | Ops visibility |
Summary
Unattended is a platform-managed Windows sign-in: dedicated identity, clean state, pinned resolution, vault-rotated credentials, and alerting.
70. Running Attended Bots
Overview
Attended bots run in the user's active session, licensed via Premium per user. Trigger options:
- From the PAD console (user clicks Run).
- From a cloud flow in attended mode (runs while the user is signed in).
- Desktop shortcuts/URI to launch a specific flow.
Design Differences vs Unattended
| Concern | Attended guidance |
|---|---|
| Screen sharing with human | Use Message boxes to coordinate ("Don't touch mouse for 2 min"), or run in quick, short bursts |
| Input dialogs | Fine here (a human is present) — never in unattended flows |
| Interruptions | Expect them: user may move focus; verify window focus before critical send-keys |
| Secrets | Prompt via sensitive input dialogs rather than storing |
Summary
Attended = digital assistant on the user's desk: interactive dialogs are allowed, but design defensively around a human sharing the mouse.
71. Machine Groups
Overview
A machine group clusters registered machines so unattended runs load-balance across them:
- Cloud flow targets the group, not a machine; the platform picks a free machine.
- More parallel work → add machines (each concurrent session consuming a Process license).
- A machine belongs to one group; group access is shareable with makers via roles.
- Hosted machine groups (Hosted Process licensing) let Microsoft provision/scale Azure-hosted bot VMs for you — no infrastructure management.
flowchart LR
CF[Cloud flow: run unattended] --> G{{Machine Group 'FIN-Bots'}}
G --> M1[BOT-VM-01]
G --> M2[BOT-VM-02]
G --> M3[BOT-VM-03]
Best Practices
- Keep machines in a group identical (image/apps/resolution) — flows must run anywhere in the group.
- Group by workload class (e.g., SAP bots vs browser bots) rather than one giant pool.
Summary
Machine groups = horizontal scaling + high availability for unattended RPA; keep members identical, or go hosted and let Microsoft manage the fleet.
72. Gateways
Overview
Historical note: desktop flows originally connected through the on-premises data gateway. This model is deprecated/retired for desktop flows — direct machine connectivity (machine-runtime app registration) replaced it. Today:
| Technology | Current role |
|---|---|
| Machine/machine-group connections | The way cloud reaches desktop flows |
| On-premises data gateway | Still used by cloud flow connectors reaching on-prem data (SQL Server connector, file shares) — not for desktop flows |
If you inherit legacy gateway-based desktop flow connections, migrate them to machine connections.
Summary
Machines connect directly now; gateways remain relevant only for cloud connectors accessing on-prem data sources.
73. Security Best Practices
Overview
| Layer | Practices |
|---|---|
| Identity | Dedicated bot accounts, least privilege in every target system, conditional access designed for unattended sign-in, credential vaulting + rotation |
| Flow content | No hardcoded secrets; sensitive variable marking; no secrets in logs/screenshots/clipboard |
| Machines | Hardened OS baseline, patching, EDR, restricted local admins, locked physical/console access, per-environment isolation |
| Data | Process only required fields; mask/aggregate in logs; respect retention & privacy (GDPR/DPDP) for extracted data |
| Platform | DLP policies (ch 75), environment security roles, share flows with groups not individuals, audit who can edit machine credentials |
| Change | Managed-solution deployments, peer review before Prod, run-history audit trails |
Warning
A bot is a privileged digital employee. Treat its account like a service account: inventory it, rotate it, monitor it, and never let humans borrow it.
Summary
Least privilege + vaulted secrets + hardened machines + platform governance. Security review belongs in the design phase, not after go-live.
74. Governance
Overview
Governance = making automation scale safely:
| Pillar | Implementation |
|---|---|
| Environment strategy | Personal/dev sandboxes, shared Dev, Test, Prod; default environment locked down |
| Intake & prioritization | CoE pipeline: idea → assessment (ROI, feasibility, risk) → build queue |
| Standards | Naming, template flow (ch 63/64), code-review checklist |
| Ownership | Every Prod flow has a named owner + backup + runbook |
| CoE Starter Kit | Inventory of flows/makers/machines, orphaned-resource detection, compliance nudges |
| Licensing management | Track Premium users, Process bot counts vs concurrent-session needs |
| Lifecycle | Periodic review: retire dead flows, re-certify credentials, update selectors |
Summary
Standards + inventory + ownership + lifecycle. The CoE Starter Kit gives you the telemetry; process discipline does the rest.
75. DLP Policies
Overview
Data Loss Prevention policies (Power Platform admin center) classify connectors into Business / Non-Business / Blocked groups; a flow can't combine connectors across Business↔︎Non-Business, and Blocked connectors can't be used at all. For desktop flows specifically, admins can additionally control desktop flow module usage — restricting risky action groups (e.g., scripting, CMD) per environment in supported configurations.
Example Policy Shape
| Group | Connectors |
|---|---|
| Business | SharePoint, Dataverse, Office 365 Outlook, Desktop flows, SQL Server |
| Non-Business | Social/media/personal connectors |
| Blocked | Consumer storage, unapproved HTTP |
Note
Test DLP changes in a sandbox first: tightening a policy can instantly break existing Prod flows that legally combined connectors before.
Summary
DLP fences what connectors (and optionally which desktop action modules) can mix — design policies per environment tier, and stage changes.
76. Monitoring
Overview
| Surface | What it shows |
|---|---|
| Portal → Desktop flow Runs | Per-run status, duration, errors, action logs |
| Monitor → Desktop flows / queues | Estate-wide run states, queued items across machines |
| Machine/Machine group pages | Machine health, connectivity, active sessions |
| Automation Center / recommended dashboards (evolving) | Consolidated ops views, ML-flagged anomalies |
| Custom: cloud flow watchers | "Run failed" branches → Teams/email/ITSM ticket |
| Custom telemetry | App Insights events from flows for cross-platform ops |
Minimum Viable Ops Setup
- Every scheduled cloud flow has a failure branch → Teams channel alert with run link.
- A daily "estate health" cloud flow queries run history → summary card (success %, failures, longest queues).
- Machine offline alerts (connectivity checks) for unattended hosts.
Summary
Portal telemetry is rich but pull-based — build push alerts (failure branches + daily summaries) so problems find you.
77. Analytics
Overview
Beyond ops monitoring: measuring the business value of automation.
| Metric | Source |
|---|---|
| Runs, success rate, durations | Dataverse run tables (flowsession etc.) / portal analytics |
| Items processed, business outcomes | Your work-queue table / custom logs |
| Hours saved | Items × manual-minutes baseline |
| Exception mix (business vs system) | Your classification discipline (ch 20) |
| License utilization | Bot session concurrency vs Process licenses |
Power BI on Dataverse is the natural stack: connect to the environment's Dataverse, model run + work-item data, publish an "Automation ROI" dashboard. The CoE Starter Kit ships starter Power BI reports covering makers, flows, and usage.
Summary
Instrument work items, not just runs — hours saved and exception mix are the numbers leadership funds.
78. Troubleshooting
A Diagnostic Method
- Read the exact error (run details → failed action,
%LastError%). - Reproduce attended in the designer with the same inputs.
- Inspect variables at the failure point (data bug vs selector bug vs environment bug).
- Compare environments: attended vs unattended session (resolution, profile, mapped drives, default browser, app version).
- Check the target app manually — half of "bot failures" are the app/system being down or changed.
- Fix at the right layer: wait, selector, data conversion, retry policy — not a blanket
Wait 10.
Environment Parity Checklist (attended works, unattended fails)
| Check | Fix |
|---|---|
| Session resolution/DPI | Pin in machine settings to match design-time |
| App not auto-started/licensed for bot user | Install/activate per-user apps for the bot account |
| Mapped drives absent in bot session | Use UNC paths |
| Browser profile/extensions differ | Configure the bot account's browser profile; reinstall extension |
| First-run dialogs (EULAs, tips) | Log in once manually as the bot user and dismiss them |
Summary
Error → reproduce → inspect → compare environments → fix at the right layer. Keep the parity checklist taped to your monitor.
79. Common Errors
| Error / symptom | Likely cause | Fix |
|---|---|---|
UI element not found |
Selector drift, window title change, timing | Wait-for-element, wildcard volatile attributes, re-capture |
Failed to launch/attach browser |
Extension missing/disabled, browser updated | Reinstall extension, restart browser, update PAD |
The file is being used by another process |
Orphaned EXCEL.EXE / open handle | Terminate process in Init/cleanup |
Text value cannot be converted to numeric |
Locale decimal separators, currency symbols | Trim/replace, convert with correct format |
| Desktop flow stuck Queued | Machine busy/offline, no free session | Check machine connectivity, group capacity, licenses |
Cannot create flows after sign-in |
No Dataverse DB in environment | Provision database / pick correct environment |
Unattended run: cannot sign in / session errors |
Wrong machine credentials, MFA prompt, console session held | Fix connection credentials, CA policy for bot, sign out console user |
| Works stepped, fails full-speed | Race condition | Replace fixed waits with Wait-for conditions |
Access denied on file/registry/service |
Bot account rights | Grant least-privilege permission needed |
| Image/OCR match fails on server | Resolution/theme/scaling differ | Pin resolution, recapture at target settings |
| Send keys typed into wrong window | Focus stolen | Focus window immediately before send; verify with If-window |
| Version mismatch machine vs portal | PAD/machine-runtime outdated | Align versions across fleet |
Part VII — Career, Projects, and Reference
80. Interview Questions
Note
A representative 75-question bank (25 per level) with answers, plus scenario/architecture/troubleshooting sets. Expand any section into a fuller bank as needed.
Beginner (25)
- What is RPA? Software that automates rule-based tasks by mimicking human UI interactions — clicking, typing, reading screens.
- What is Power Automate Desktop? Microsoft's desktop RPA tool for building desktop flows that automate Windows apps, browsers, and files.
- Desktop flow vs cloud flow? Desktop flows run on a Windows machine automating UIs; cloud flows run in the cloud using API connectors.
- What are actions? Prebuilt, configurable steps (400+) that make up a flow.
- How do you reference a variable? With percent notation:
%VariableName%; properties via dot:%File.Name%. - Attended vs unattended? Attended runs in a signed-in user's session (user present); unattended signs into the machine itself with no user.
- What license enables attended RPA? Power Automate Premium (per user). Unattended needs a Process license per bot.
- Where are desktop flows stored? In Dataverse in the selected environment (work/school accounts).
- Name the loop types. Loop (counter), For each (collection), Loop condition (while).
- What is a datatable? A rows-and-columns variable (like an in-memory spreadsheet), produced by Excel/CSV/SQL reads.
- How do you handle an action failing intermittently? On-error tab: retry N times with a delay; escalate if exhausted.
- What is a subflow? A named block of actions within a flow, invoked with Run subflow; shares the flow's variables.
- What are input/output variables? The flow's parameter contract with callers (users or cloud flows).
- What does the recorder do? Watches your interactions and generates draft actions to refine.
- What is a UI element? A captured selector identifying a control (button, field) in an app or web page.
- How do you read Excel data efficiently? Read the whole range with headers into a datatable once — never cell-by-cell.
- What is Send keys used for? Typing keystrokes into the focused window when element-level input isn't possible.
- Difference between Wait and Wait for element? Fixed delay vs event-driven wait — always prefer the latter.
- What is
%LastError%-style error info used for? Capturing failure details in handlers for logs and alerts. - Can PAD run on Windows Home? Yes for local authoring/running, but cloud-triggered runs aren't supported on Home editions.
- What's the machine-runtime app? The component registering a machine with the cloud so flows can be triggered remotely.
- How do you pass data between desktop and cloud flows? Input/output variables on the desktop flow, mapped in the cloud action.
- What is Switch used for? Branching one value across many cases, cleaner than chained else-ifs.
- How do you stop a flow deliberately? Stop flow action (end as success or throw an error).
- Why mark a variable sensitive? To mask its value in the variables pane and logs (passwords, tokens).
Intermediate (25)
- How does On block error differ from action-level On error? Action-level handles one step (retry/continue); On block error wraps a region like try/catch with a handler subflow and continuation rules.
- Business vs system exceptions — why distinguish? Business errors (bad data) shouldn't be retried, they're routed to humans; system errors (crashes/timeouts) are retried with clean state.
- How do you make a batch survive one bad record? Item-level On block error inside the loop; log, mark item failed, continue.
- How do you schedule a desktop flow? Recurrence-triggered cloud flow calling "Run a flow built with PAD" (unattended).
- What are machine groups? Clusters of identical machines; the platform load-balances unattended runs across them.
- How would you extract a value between two labels in text? Crop text (get text between markers) — regex only if the pattern varies.
- JSON response handling? Convert JSON to custom object; navigate
%Obj['a']['b']%; lists iterate with For each. - How do you call a REST API with auth? Invoke web service with Authorization header; branch on status code; parse JSON response.
- Why do numbers from Excel break comparisons? They often arrive as text; convert explicitly before arithmetic/comparison.
- How do you keep selectors maintainable? Anchor on stable attributes (id/name/automation id), wildcard volatile parts, centralize per-app interactions in library flows.
- How do you run real Python (with pandas)? Not the built-in action (IronPython) — invoke CPython via Run DOS command with arguments, exchange JSON/files.
- Where should configuration live? Inputs fed by Power Platform environment variables (per-environment), machine-local settings for machine-specific paths; secrets in a vault.
- How do you reuse logic across flows? Child desktop flows with input/output contracts (Run desktop flow action).
- Excel is "locked" every second run — why? Orphaned EXCEL.EXE from a failed run; terminate it in Init/cleanup.
- How do you parallelize processing? Work-queue table + multiple unattended performers across a machine group; queue states prevent double-processing.
- How do you wait for a file from another system? Wait for file action or a Loop-condition poll with attempts cap and timeout behavior.
- What's the role of the browser extension? It bridges PAD and the browser DOM for web actions; without it web automation fails.
- How do you take evidence on failure? Error subflow: Take screenshot + error details + item ID into logs/quarantine.
- How do you handle a legacy app with no accessibility tree? Image recognition for interaction, OCR for reading, coordinates as last resort — with pinned resolution.
- What is idempotency for bots? Safe reruns: check "already processed" (keys/status) before acting, so recovery doesn't duplicate work.
- How are desktop flows versioned/promoted? Solutions exported Dev→Test→Prod (managed), with environment variables/connection references per stage; pac CLI/pipelines automate it.
- What DLP controls apply? Connector grouping (Business/Non-business/Blocked); optionally restricting desktop-flow modules per environment.
- How do you monitor an estate? Portal run history + Monitor pages, plus push alerts from cloud-flow failure branches and daily summary flows.
- Attended flow needs a password — pattern? Sensitive input dialog at runtime, or vault retrieval; never stored in the flow.
- A flow works stepping but fails at speed — diagnosis? Race condition: missing explicit waits; replace fixed delays with wait-for-state actions.
Advanced (25)
- Design a framework for 20 processes. Shared template (Init/GetWork/Try-Classify-Retry/Cleanup/Report), library flows per app screen, SQL work queues, config tables, central logging, standard outputs — chapter 63/65 patterns.
- Dispatcher/Performer — why and how? Separates intake from processing for scaling and resilience: dispatcher validates and enqueues; N performers consume with row-locking updates.
- How do you achieve high availability? Machine groups with identical members, queued runs, health alerts, idempotent items, and a warm standby machine image.
- Concurrency control on a shared queue? Atomic claim:
UPDATE TOP(1) ... OUTPUTwith status transition; attempts counters; stale-lock reaper for crashed sessions. - Credential architecture for 50 bots? PAM/Key Vault as source of truth, rotation pipelines updating machine connections, per-system least-privilege accounts, zero secrets in flows, audit on checkout.
- How do you handle MFA/conditional access for unattended bots? Dedicated bot identities with tailored CA policies (trusted locations/compliant machines) per security team guidance — never disabling security globally.
- Hosted machine groups — trade-offs? Pros: no infra, elastic scale, Microsoft-managed images. Cons: cost per bot ($215 list), image customization limits, network line-of-sight to on-prem apps must be solved (VNet).
- CI/CD design? Git-backed unpacked solutions, PR review, build validation, automated import to Test with smoke-test flows, gated Prod deploys, environment variables per stage.
- How would you migrate 100 WinAutomation/UiPath bots? Inventory → complexity triage → rebuild patterns (not 1:1 translation) → shared framework first → pilot → factory waves with parallel-run verification.
- Deep SAP automation — approach? Prefer SAP GUI scripting (enable client+server), stable IDs; BAPIs/IDocs via middleware where possible; screen automation only for gaps; per-transaction library flows.
- When is PAD the wrong tool? Stable APIs exist (use cloud flows/integration), massive data transformation (use SQL/Spark/Python), millisecond latency needs, or long-term core integrations better served by engineering.
- How do you cap blast radius of a rogue bot? Least-privilege accounts, environment isolation, DLP, circuit breakers, transaction limits/checkpoints, and human-approval gates for high-value actions.
- Design monitoring for 24/7 operations. Failure-branch alerts to on-call, heartbeats for long runs, queue-depth alarms, machine health probes, daily/weekly ROI and exception-mix reporting.
- Handling application updates that break selectors estate-wide? Screen-object library isolates changes; UI change-detection smoke flow runs after patch windows; versioned selector sets per app release.
- Data privacy in RPA — controls? Field minimization, masked logging, retention policies on evidence/screenshots, regional storage compliance, DPIA for processes touching personal data.
- How do you test desktop flows? Unit-ish: library flows with test-harness callers and mock inputs; integration: Test environment with sandboxed target systems and synthetic data; regression: smoke suite post-deploy.
- Explain queuing when a machine group is saturated. Runs queue in order per group; monitor queue depth; scale members or reprioritize; design SLAs on queue latency, not just run time.
- Long-running process (4h) best practices? Checkpointing to the queue/DB, heartbeat logging, resumability from last checkpoint, split into stages orchestrated by the cloud flow.
- Integrating AI document understanding — architecture? Cloud flow + AI Builder extracts fields (with confidence scores); low-confidence → human validation (approvals); high-confidence → desktop flow enters into legacy system; feedback loop retrains model.
- Cross-environment differences keep breaking flows — systemic fix? Golden machine image, config as environment variables, environment-parity checklist automated as a validation flow, drift detection.
- What belongs in the cloud flow vs desktop flow? Everything connector/AI/approval-shaped in cloud; only UI-bound work on desktop — minimizes machine time, maximizes observability.
- License optimization for mixed workloads? Consolidate unattended jobs to maximize per-bot utilization (schedule packing), attended Premium only for actual runners, monitor concurrency to right-size Process count.
- Explain the retired gateway model. Desktop flows once connected through the on-prem data gateway; direct machine connectivity replaced it — gateways now matter only for cloud connectors reaching on-prem data.
- How do you keep a 3-year-old bot healthy? Ownership + runbook, quarterly recertification (credentials, selectors, volumes), dependency watch (app versions), and metrics that trigger refactor/retire decisions.
- Biggest cause of RPA program failure? Process selection and governance, not technology: automating unstable/low-value processes without ownership, standards, or exception design.
Scenario Questions (starter set)
- Every morning at 6, download 4 portal reports, consolidate into Excel, email leadership by 7. — Recurrence cloud flow → unattended desktop flow (Download-from-web ×4 with validation) → Excel datatable merge → cloud flow sends mail; failure branch alerts by 6:30.
- An invoice bot fails at 2 a.m.; morning finds 300 unprocessed items. — Diagnose from run history + screenshot evidence; fix; rerun is safe because items carry statuses (idempotency); add circuit-breaker + on-call alert so it never silently dies again.
- Business asks to automate a process that changes weekly. — Push back: stabilize first or make the variable part config-driven/human-in-loop; RPA on unstable processes is technical debt on fast-forward.
81. Real-world Projects
Portfolio-grade project ideas, ordered by difficulty:
| # | Project | Core skills |
|---|---|---|
| 1 | Folder janitor: sort downloads by type/date | Files, folders, loops |
| 2 | Daily weather/news snapshot to email | Web scraping, SMTP/Outlook |
| 3 | Bulk file renamer with Excel mapping | Excel datatables, rename patterns |
| 4 | PDF splitter/merger utility with input dialogs | PDF actions, attended UX |
| 5 | Invoice intake: mailbox → OCR/AI Builder → Excel register | Email, OCR/AI, datatables |
| 6 | Web form filler from spreadsheet (100 records) | Browser automation, error isolation |
| 7 | SQL-to-ERP sync via UI (legacy app) | DB actions, UI automation, exception framework |
| 8 | Employee onboarding: AD + M365 + folder provisioning | PowerShell integration, orchestration |
| 9 | Report factory: download → transform (Python) → distribute | Hybrid scripting, scheduling |
| 10 | Full dispatcher/performer queue system on a 2-machine group | Enterprise patterns end-to-end |
Each becomes interview gold when you can discuss its exception design and metrics, not just its happy path.
82. End-to-End Case Study
Scenario: Accounts Payable Invoice Automation at "Contoso Manufacturing"
Problem. 1,800 supplier invoices/month arrive as PDF email attachments; two clerks key them into a legacy ERP (no API). Average 6 min/invoice, ~2.2% keying-error rate, month-end overtime.
Solution architecture.
flowchart TB
MB[Shared mailbox<br>invoices@contoso.com] -->|new mail trigger| CF1[Cloud Flow: Intake]
CF1 --> AIB[AI Builder<br>invoice model]
AIB -->|fields + confidence| DEC{Confidence ≥ 90%?}
DEC -->|No| HV[Teams approval:<br>human validates fields] --> Q
DEC -->|Yes| Q[(Dataverse work queue)]
SCH[Recurrence 07:00-19:00<br>every 15 min] --> CF2[Cloud Flow: Orchestrator]
CF2 -->|batch of New items| MG{{Machine group AP-BOTS ×2}}
MG --> DF[Desktop Flow: ERP Entry<br>UI automation + exception framework]
DF -->|DocNo / error class| CF2
CF2 --> RPT[Daily summary card<br>+ quarantine notifications]
Key design decisions.
| Decision | Rationale |
|---|---|
| AI extraction in cloud, typing on desktop | Minimizes bot-machine time; confidence gating adds human-in-the-loop only where needed |
| Dataverse queue with statuses + attempts | Restartability, parallel performers, full audit |
| 2-machine group, unattended (2× Process licenses) | Throughput ~1 invoice/70s/bot covers volume with headroom |
| Exception framework (ch 63) in the desktop flow | Business errors (missing PO) → quarantine view for clerks; system errors → 2 retries with app reset |
| Evidence: screenshot + extracted-vs-entered field log per failure | 2-minute triage instead of ERP archaeology |
Build sequence (8 weeks). Wk1–2 process definition + sample-doc model training; Wk3–4 desktop flow against ERP test instance (screen library first); Wk5 queue + orchestrator; Wk6 UAT with parallel run (bot vs clerks on same batch); Wk7 hardening (resolution pinning, credential vaulting, alerts); Wk8 hypercare go-live.
Results (steady state). 91% touchless rate; keying errors ≈ 0 on touchless items; clerks reassigned to exception handling and supplier queries; payback < 5 months including licenses and build effort.
Lessons. The ERP screen library absorbed two ERP patch cycles with single-flow fixes; the confidence threshold was tuned from 90→85% after a month of accuracy data; the circuit breaker fired once (ERP outage) and saved 400 doomed retries.
83. Enterprise Architecture
Reference Architecture
flowchart TB
subgraph Experience
U[Makers & Business Users]
COE[CoE / Automation Team]
end
subgraph PowerPlatform["Power Platform (per environment: Dev/Test/Prod)"]
CFL[Cloud Flows<br>orchestration, connectors, AI Builder]
DFL[Desktop Flows<br>Dataverse-stored]
EV[Environment variables<br>Connection references]
DLP[DLP Policies]
end
subgraph Runtime
MG1{{Machine Groups<br>on-prem VMs}}
HMG{{Hosted Machine Groups<br>Azure}}
end
subgraph Enterprise["Enterprise Systems"]
SAAS[SaaS APIs]
LEG[Legacy / Desktop Apps]
DB[(SQL / Data platforms)]
end
subgraph Ops["Security & Operations"]
PAM[Key Vault / PAM]
MON[Monitoring & Alerting]
ALM[Git + Pipelines]
ENTRA[Entra ID<br>bot identities + CA]
end
U --> CFL
COE --> DLP
CFL --> SAAS
CFL --> DFL --> MG1 & HMG --> LEG
DFL --> DB
PAM --> MG1
ENTRA --> MG1 & HMG
ALM --> PowerPlatform
MON --> Runtime & PowerPlatform
Architecture Principles
- API-first, UI-last — desktop flows only where connectors can't reach.
- Environment isolation — separate machines, credentials, DLP per tier.
- Everything-as-config — environment variables + config tables; artifacts immutable across tiers.
- Identity-centric security — bot accounts governed like service accounts under Entra + PAM.
- Queue-centric scale — work queues decouple intake, processing, and reporting.
- Observable by default — no Prod flow without alerts, evidence capture, and an owner.
Summary
Enterprise PAD is 20% flow-building and 80% platform: identity, environments, queues, pipelines, and operations wrapped around the bots.
84. Frequently Asked Questions
Is PAD free? The app is included for Windows 10/11 users for local attended authoring/running. Cloud triggering, sharing, and unattended runs require Premium (15/user/mo)orProcess(150/bot/mo) licensing.
Do I need coding skills? No for typical flows; yes (PowerShell/regex/SQL basics) to be good at complex ones.
Can PAD automate Citrix/remote desktops? Yes — via image recognition and OCR, since only pixels are available. Expect more maintenance than element-based automation.
Can one machine run multiple bots at once? With multi-session-capable Windows and sufficient Process licenses, yes — each unattended session is separate.
Mac/Linux support? No. PAD runs on Windows only (and not on ARM devices).
PAD vs UiPath/Automation Anywhere? PAD wins on cost of entry, M365/Power Platform integration, and citizen-developer reach; dedicated vendors offer deeper orchestrators and broader advanced tooling. Many enterprises run both.
Can a desktop flow run when the PC is locked/off? Unattended runs sign in themselves (machine must be on and reachable). Powered-off machines can't run flows — use hosted machine groups or always-on VMs.
How do I hand a flow to a colleague? Share it from the portal (co-owner/run-only), or move it via solutions — don't copy-paste actions as your ALM strategy.
Where do I ask questions? Microsoft Learn documentation, the Power Automate community forums, and the product's in-designer Copilot assistance.
85. Cheat Sheet
Keyboard Shortcuts (Designer)
| Shortcut | Action |
|---|---|
| F5 / Shift+F5 | Run / Stop |
| F10 | Run next action (step) |
| F6 | Toggle breakpoint |
| Ctrl+S | Save |
| Ctrl+F | Search actions/flow |
| Ctrl+C/V | Copy/paste actions (works across flows) |
| Ctrl+Z / Ctrl+Y | Undo / Redo |
Variable & Expression Quick Reference
| Task | Expression |
|---|---|
| Use variable | %Name% |
| Arithmetic | %Counter + 1%, %Price * Qty% |
| Property | %File.NameWithoutExtension% |
| List item / table cell | %List[0]%, %Table[2]['Col']% |
| Boolean literals | %True%, %False% |
| Escape a percent sign | %% |
Date Format Tokens
| Token | Output |
|---|---|
yyyy-MM-dd |
2026-07-20 |
dd-MMM-yyyy |
20-Jul-2026 |
HH:mm:ss |
14:05:09 |
dddd |
Monday |
High-Frequency Actions by Domain
| Domain | Go-to actions |
|---|---|
| Files | Get files in folder → For each → Copy/Move/Rename; Wait for file |
| Excel | Launch → Read range (headers) → datatable → Write range → Save/Close |
| Text | Crop text, Split text, Replace text, Parse text (regex) |
| Web | Launch browser → Wait for content → Populate/Click → Extract data → Close |
| UI | Wait for window → Focus → Click/Populate element → Extract data from window |
| OCR/Image | Wait for text (OCR), Extract text with OCR, Wait for image, Click image |
| Integration | Invoke web service, Download from web, Convert JSON ↔︎ custom object |
| Scripting | Run PowerShell script, Run DOS command (check exit codes) |
| Reliability | On block error, Retry (On-error tab), Take screenshot, Terminate process |
Error-Handling Pattern Card
Init: kill stale apps → validate inputs
Per item: On block error → { do work } → classify Business/System → retry System ×2
On fail: screenshot + log + quarantine item → continue batch
Cleanup: close/terminate apps → summary log → set output Status
86. Glossary
| Term | Definition |
|---|---|
| Action | One configurable step in a desktop flow |
| AI Builder | Power Platform's AI model service (document processing, GPT prompts, etc.) |
| Attended RPA | Automation running in a signed-in user's session |
| Cloud flow | Connector/API-based Power Automate flow running in the cloud |
| CoE Starter Kit | Microsoft's governance/inventory toolkit for Power Platform |
| Connection reference | Solution component pointing a flow at an environment's connection |
| Dataverse | Power Platform's data service; stores desktop flow definitions and run logs |
| Desktop flow | An RPA automation built with PAD |
| DLP policy | Admin rules grouping connectors (Business/Non-business/Blocked) |
| DPA | Digital Process Automation — API-based automation (cloud flows) |
| Environment | An isolated Power Platform container (data, flows, policies) |
| Environment variable (PP) | Per-environment configuration value carried in solutions |
| Hosted machine group | Microsoft-managed Azure VMs for unattended bots |
| Machine group | A load-balanced cluster of registered bot machines |
| Machine-runtime app | Component registering a machine for cloud-triggered runs |
| Managed solution | Locked, deployable solution package for Test/Prod |
| OCR | Optical character recognition — reading text from images/screens |
| PAD | Power Automate for desktop |
| Process license | Per-bot license enabling unattended RPA |
| Selector | Attribute-based address of a UI element |
| Subflow | Named callable block inside a desktop flow |
| UIA | Windows UI Automation accessibility framework PAD uses to inspect apps |
| Unattended RPA | Automation where the platform signs into the machine itself |
| Work queue | A state-tracked table of items feeding bots (New/Processing/Done/Failed) |
87. Learning Resources
| Resource | What it offers |
|---|---|
| Microsoft Learn — Power Automate desktop flows documentation | Authoritative reference for every action, requirement, and admin capability |
| Microsoft Learn training paths ("Get started with Power Automate for desktop" and successors) | Free structured modules with exercises |
| Power Automate Blog (Microsoft) | Release notes and new-feature announcements — PAD ships monthly |
| Power Platform release plans | What's coming in the next waves |
| Power Automate community forums | Q&A with MVPs and the product team |
| PAD in-product examples | The console ships sample flows worth dissecting |
| CoE Starter Kit docs/GitHub | Governance tooling and reference implementations |
| Certification: PL-500 (Microsoft Power Automate RPA Developer) | The credential aligned to everything in this guide |
| Hands-on above all | The 10 projects in chapter 81 teach more than any video series |
Tip
PAD evolves monthly. Skim the release notes with each designer update — actions get added and improved constantly, and yesterday's workaround is often today's built-in action.
88. Hands-on Labs
Six full labs, then quick-spec briefs for the remaining scenarios.
Lab 1 — Bulk File Rename from an Excel Mapping
Objective. Rename hundreds of files using an Excel old-name→new-name mapping. Prerequisites. PAD installed; folder C:\Lab1\Files; C:\Lab1\map.xlsx with columns OldName, NewName.
Flow design.
Launch Excel (map.xlsx) → Read range (headers) → MapTable → Close Excel
For each Row in MapTable
If file exists C:\Lab1\Files\%Row['OldName']%
Rename file → %Row['NewName']%
Else
Run subflow Log('WARN','Missing: %Row['OldName']%')
End
Expected output. Files renamed; warnings logged for misses. Enhancements. Collision detection (target exists), dry-run mode via input variable, results written back to a Status column.
Lab 2 — Bulk PDF Merge
Objective. Merge all PDFs in a folder into one, ordered by filename. Prerequisites. C:\Lab2\In with numbered PDFs.
Flow design.
Get files in folder: C:\Lab2\In, *.pdf, sort by name ascending → PdfList
If %PdfList.Count% = 0 → Stop flow with error 'No PDFs found'
Merge PDF files: %PdfList% → C:\Lab2\Out\Merged_%Today%.pdf
Expected output. One ordered merged PDF. Enhancements. Input dialogs for folders (attended utility), cover-page generation via Word→PDF, post-merge page-count validation (extract + count).
Lab 3 — Outlook Invoice Intake to Excel Register
Objective. Pull unread invoice emails, save attachments, register rows in Excel. Prerequisites. Desktop Outlook profile; C:\Lab3\Register.xlsx with headers Date | From | Subject | File.
Flow design.
Launch Outlook → Retrieve emails (Inbox, unread, subject contains 'Invoice',
save attachments to C:\Lab3\Attachments) → Mails
Launch Excel (Register.xlsx) → Get first free row → R
For each M in Mails
Write to Excel: row %R% ← %CurrentDateTime% | %M.From% | %M.Subject% | %M.Attachments%
Set R = %R + 1%
Process email: mark read, move to 'Invoices\Processed'
End
Save & Close Excel; Close Outlook
Expected output. Register grows; mailbox stays clean. Enhancements. PDF text extraction of invoice number/amount into extra columns; duplicate detection; error isolation per mail.
Lab 4 — Web Data Extraction to CSV (Books Demo)
Objective. Scrape a paginated catalog (use a scraping-practice site such as books.toscrape.com) into CSV with numeric prices.
Flow design.
Launch new Chrome → catalog URL
Extract data from web page: title, price, availability as table,
across pages via 'next' pager → WebTable
Close browser
For each Row: Replace text '£' → '' ; Convert to number → rebuild CleanTable
Write to CSV: C:\Lab4\books_%Today%.csv
Expected output. Multi-page CSV with clean numeric prices. Enhancements. Wait-for-content guards, per-page delay, top-10-by-price summary via sort, email the CSV.
Lab 5 — SQL Data Import with Validation
Objective. Load a daily CSV into SQL Server with row validation and a reject file. Prerequisites. SQL DB with Staging.Sales(Id, Region, Amount, LoadDate); ODBC access.
Flow design.
Read from CSV: C:\Lab5\sales.csv (headers) → Data
Create datatable Rejects (same columns + Reason)
Open SQL connection
For each Row in Data
If %Row['Amount']% is not numeric OR %Row['Region']% is empty
Insert into Rejects (+Reason) ; Next loop
Execute SQL: INSERT INTO Staging.Sales VALUES (%Row['Id']%,'%Row['Region']%',%Row['Amount']%, GETDATE())
End
Close SQL connection
If %Rejects.RowsCount% > 0 → Write to CSV rejects_%Today%.csv → email ops
Expected output. Clean rows loaded; rejects quarantined with reasons. Enhancements. Batch multi-row INSERTs for speed; wrap in the exception framework; reconciliation count check (CSV rows = loaded + rejected).
Lab 6 — Hybrid: Cloud-Triggered Desktop Flow (Attended → Unattended path)
Objective. A cloud flow triggered by a SharePoint list item runs a desktop flow that generates a Word→PDF letter and posts the link back.
Flow design.
- Desktop flow
GenerateLetter: inputsName,Amount; Word template find/replace → Save as PDF to a synced/shared path; outputsPdfPath,Status. - Cloud flow: SharePoint "when item created" → Run desktop flow (inputs from item) → upload PDF (file content) to a document library → update item with link → failure branch posts to Teams.
Expected output. New list item ⇒ personalized PDF appears in the library within a minute. Enhancements. Switch run mode to unattended on a machine group; add AI Builder GPT action to draft a custom paragraph; add approval before generation.
Quick-Spec Briefs (build them the same way)
| Lab | Sketch |
|---|---|
| OCR Invoice Reader | Get PDFs → Extract text (OCR for scans) → regex invoice no/date/total → validated datatable → Excel register; low-confidence → manual folder |
| Employee Onboarding | Excel/queue of new hires → PowerShell (AD user, groups, mailbox via module) → folder provisioning → welcome email → status write-back |
| HR Automation (leave reconciliation) | Download HRMS report (browser) → compare with payroll extract (datatable join logic) → discrepancy report → Teams alert |
| Payroll Processing support | Gather timesheet CSVs → validate/aggregate → enter exceptions into payroll UI via screen library → evidence log per entry |
| SAP Automation | Enable SAP GUI scripting → Lib_SAP_Login → per-transaction subflows (VA01/FB60 style) → queue-driven, exception framework mandatory |
| Legacy app automation | UI-tree capture first; fall back to image/OCR; pinned resolution; wrap every screen in waits + verification reads |
| Download reports | Loop over a config table of portal/report/credential rows → Download-from-web or browser clicks → validate file → archive by date |
End of guide.
No comments:
Post a Comment