Cloud Flow Calling Desktop Flow

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 12 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Cloud Flow Calling Desktop Flow: Bridging the Gap Between Web and Local Automation

Introduction: The Power of Hybrid Automation

In the modern landscape of business process automation, we often find ourselves working in two distinct worlds: the cloud-based world of APIs, web services, and Software-as-a-Service (SaaS) platforms, and the legacy world of desktop applications, local spreadsheets, and internal databases that lack modern connectivity. Cloud flows, which operate entirely within the browser-based environment of Power Automate, are excellent for orchestrating cloud services like Microsoft 365, Salesforce, or Twitter. However, they hit a wall when they encounter a local Windows application that does not have an API.

This is where the concept of "hybrid automation" becomes essential. By triggering a desktop flow from within a cloud flow, you combine the scalability and reach of cloud-based services with the tactile, manual-simulation capabilities of desktop automation (RPA). This integration allows you to build a bridge between your modern web infrastructure and your legacy desktop software. Understanding how to connect these two environments is a critical skill for any automation developer, as it allows you to automate end-to-end processes that would otherwise require human intervention to bridge the gap between systems.

Not read yet

Understanding the Architecture: Cloud Flows vs. Desktop Flows

Before we dive into the "how," we must understand the "what" and "why" of the architecture. A cloud flow acts as the orchestrator. It is event-driven, meaning it can be triggered by a specific event like an email arriving, a button being pressed in a mobile app, or a scheduled time. Because it lives in the cloud, it has access to the vast connector ecosystem that allows it to talk to hundreds of different web services.

A desktop flow, by contrast, acts as the "worker." It runs on a specific machine (or a group of machines in a cluster) and interacts directly with the Windows UI. It can click buttons, type into text fields, scrape data from screens, and interact with local files. When you call a desktop flow from a cloud flow, the cloud flow acts as the manager that says, "Go perform this local task," waits for the result, and then continues its cloud-based workflow.

Callout: The "Orchestrator vs. Worker" Pattern Think of a cloud flow as a project manager who handles communication, scheduling, and high-level strategy. The desktop flow is the specialist worker who sits at a computer and physically performs the tasks that require local access. This separation of concerns is the fundamental principle of successful hybrid automation.

Not read yet

Prerequisites for Hybrid Automation

To successfully call a desktop flow from a cloud flow, you need to ensure your environment is configured correctly. This setup can sometimes be the most challenging part of the process, as it involves network communication and security configurations.

1. The Power Automate Machine Runtime

You must have the Power Automate desktop application installed on the target machine. More importantly, this machine must be registered in the Power Automate portal. This registration allows the cloud service to "see" your local machine and send instructions to it.

2. The Gateway vs. Direct Connection

Historically, users needed an On-premises Data Gateway to facilitate this communication. While you can still use a gateway, modern Power Automate architecture now supports direct machine connections. This simplifies the process significantly, as it removes the need for a separate gateway server in many enterprise scenarios.

3. User Identity and Authentication

The cloud flow needs to authenticate against the machine. This is typically handled through a "Connection" object in Power Automate. You will need to provide the Windows credentials (username and password) of the user account that will be logged into the target machine to run the flow.

Not read yet

Step-by-Step: Creating the Connection

To begin, you must create a connection that links your cloud environment to your desktop machine. Follow these steps carefully to avoid common authentication errors:

  1. Navigate to the Power Automate Portal: Go to your Power Automate environment and look for the "Connections" tab in the left-hand menu.
  2. Create a New Connection: Click on "New connection" and search for "Power Automate for desktop."
  3. Select Connection Method: You will be prompted to choose between "Connect with gateway" or "Connect directly to machine." If your organization allows it, choose "Connect directly to machine" for better performance and easier management.
  4. Enter Credentials: Provide the Windows username and password of the account that will execute the desktop flow.

    Warning: Ensure that the account you use has the necessary permissions to run applications on that machine. Avoid using your personal credentials if possible; a service account with limited, specific permissions is the industry standard for production environments.

  5. Select the Machine: You will see a list of machines registered to your environment. Select the specific machine or machine group you wish to target.
  6. Finalize: Once saved, this connection object can be reused across multiple cloud flows.

Not read yet

Developing the Desktop Flow

Before you can call a flow, you must have one ready to be called. Desktop flows are built using the Power Automate for Desktop (PAD) designer. When designing a flow that is intended to be called by a cloud flow, you must focus on two specific areas: Input and Output variables.

Defining Input Variables

Input variables allow your cloud flow to pass data into the desktop flow. For example, if your cloud flow receives a customer name from an email, it should pass that name into the desktop flow so the desktop flow knows which customer record to open.

To define an input variable in PAD:

  1. Open your desktop flow in the designer.
  2. Click the "Input/Output variables" pane on the right side.
  3. Click the "+" icon to create a new variable.
  4. Select "Input" as the type.
  5. Give it a descriptive name (e.g., CustomerName).
  6. Assign a default value if necessary, though this will be overwritten by the cloud flow.

Defining Output Variables

Output variables allow the desktop flow to send data back to the cloud flow. Perhaps your desktop flow extracts a transaction ID from a local legacy system. That ID needs to be sent back to the cloud flow so it can be stored in a database or sent in a confirmation email.

To define an output variable in PAD:

  1. In the same "Input/Output variables" pane, create a new variable.
  2. Select "Output" as the type.
  3. Give it a descriptive name (e.g., TransactionID).

Not read yet

Calling the Desktop Flow from a Cloud Flow

Now that the connection is established and the desktop flow is prepared with input/output variables, you are ready to build the cloud flow.

  1. Create a new Cloud Flow: Start with your preferred trigger (e.g., "When an email arrives").
  2. Add the Desktop Flow Action: Click "New step" and search for "Power Automate for desktop." Select the action "Run a flow built with Power Automate for desktop."
  3. Configure the Action:
    • Run mode: Choose "Attended" (if a human is logged in and needs to see the action) or "Unattended" (if the machine should run the task in the background). Note that Unattended mode requires a specific license.
    • Desktop flow: Select the flow you created from the dropdown list.
    • Inputs: You will see the input variables you defined in your desktop flow. Map the dynamic content from your cloud flow to these inputs.
  4. Handle Outputs: Once the action completes, the output variables from your desktop flow will be available as dynamic content in the subsequent steps of your cloud flow.

Callout: Attended vs. Unattended RPA Attended automation is like having a robot assistant sitting next to you; it works on your machine while you watch, often requiring your input. Unattended automation is like a factory worker who works in a separate room; it runs on a dedicated machine without human intervention. Choose your license and setup accordingly.

Not read yet

Handling Common Pitfalls and Troubleshooting

Even with a perfect setup, things can go wrong. Desktop automation is inherently fragile because it relies on the state of the screen and the responsiveness of local applications. Here is how to manage common issues.

1. Timing and Wait Times

The most common mistake is assuming the computer is as fast as the cloud. If your desktop flow clicks a button and immediately tries to type into a field that hasn't loaded yet, the flow will fail. Always use "Wait for window" or "Wait for element" actions rather than hard-coded "Wait" (sleep) actions. Hard-coded waits are inefficient and prone to failure if the system lags.

2. Screen Resolution and Scaling

Desktop flows are sensitive to screen resolution. If you record an automation on a 4K monitor and then run it on a server with a 1080p resolution, the coordinates or UI elements might not be found.

  • Tip: Always use "UI elements" (selectors) rather than "Mouse coordinates" to identify buttons and fields. UI elements are more resilient to changes in resolution and window positioning.

3. Error Handling

Always wrap your desktop flow steps in "On block error" blocks. If an application crashes or fails to open, you want your flow to handle the error gracefully rather than just failing silently. You can set the error handling to "Continue flow run" and then check the value of the LastError variable to decide your next move, such as sending an email notification to the administrator.

4. Credential Management

Never hard-code passwords inside your desktop flow scripts. If you need to log into a legacy system, use the "Credential Manager" in Windows or securely pass the credentials from the cloud flow using a secure variable.

Not read yet

Best Practices for Enterprise-Grade Automation

When you are building automations that will be used in a production environment, you need to think beyond just "making it work." You need to build for maintainability and scalability.

  • Modularize your flows: Don't build one massive, 500-step desktop flow. Break your automation into smaller, reusable sub-flows. For example, have one sub-flow for "Open Application," one for "Process Data," and one for "Close Application."
  • Logging: Since cloud flows have a run history, but desktop flows can be harder to audit, write your own logs to a local text file or a SharePoint list. This allows you to track exactly what happened inside the desktop session.
  • Environment Variables: Use environment variables for paths, URLs, and server names. If your application moves to a different server, you only have to update one setting rather than editing every single flow.
  • Naming Conventions: Develop a strict naming convention for your flows, variables, and UI elements. As your library of automations grows, a lack of organization will lead to significant technical debt.

Not read yet

Comparison: Cloud Flow vs. Desktop Flow Capabilities

Feature Cloud Flow Desktop Flow
Primary Environment Web Browser / API Windows OS / Desktop UI
Connectivity 1000+ Connectors Local Apps, Excel, SAP, Terminal
Execution Cloud infrastructure Local Machine / VM
Primary Use Case Data movement, APIs, Notifications Legacy app interaction, screen scraping
Scalability High (Serverless) Limited by machine availability

Managing Unattended Automation Licenses

One of the most frequent questions regarding calling desktop flows is about licensing. Unattended automation is a premium feature. If you intend to run desktop flows on a machine where no one is logged in, you must purchase the "Power Automate Process" license.

Note: If you are running an "Attended" flow, the user running the flow must have a "Power Automate Premium" license. Always verify your organization's licensing status with your IT department before deploying to production, as failing to do so can result in service interruptions.

Not read yet

Practical Example: Automating a Legacy Data Entry Task

Let's walk through a scenario: You receive an email with an invoice attached. Your goal is to take the data from that email and input it into an old, non-web-based accounting application.

  1. Cloud Flow Trigger: "When a new email arrives (V3)."
  2. Cloud Flow Action: "Get attachment" (to retrieve the invoice).
  3. Cloud Flow Action: "Run a flow built with Power Automate for desktop."
    • Pass the invoice data (extracted via AI Builder or simple text parsing) as input variables to the desktop flow.
  4. Desktop Flow:
    • Action: Launch the accounting application.
    • Action: Click "New Entry."
    • Action: Populate fields using the input variables (e.g., InvoiceNumber, Amount, VendorName).
    • Action: Click "Save."
    • Action: Extract the "Confirmation Number" from the screen and set it as an output variable.
  5. Cloud Flow:
    • Receive the "Confirmation Number" from the desktop flow.
    • Action: Send a confirmation email back to the requester with the confirmation number.

This example highlights the power of the hybrid model. The cloud flow handles the email and the communication, while the desktop flow handles the heavy lifting of interacting with the clunky, legacy software.

Not read yet

Common Questions (FAQ)

Q: Why does my desktop flow run slowly when triggered from the cloud?

A: Often, this is due to the machine being under-powered or having too many background processes. Ensure your dedicated automation machines are optimized for performance. Also, ensure your flow is not using excessive "Wait" actions.

Q: Can I run multiple desktop flows on one machine at the same time?

A: No, a single Windows machine can only support one active desktop flow session at a time in attended or unattended mode. If you need to run multiple flows in parallel, you must set up a "Machine Group" (a cluster of machines) and have your cloud flow target the group rather than an individual machine.

Q: How do I handle pop-up dialogs in my desktop flow?

A: Use the "If window exists" or "Wait for window" action. If a pop-up is unpredictable, use a "Try/Catch" block structure to handle the pop-up if it appears, and continue if it doesn't.

Q: Is it secure to send credentials to a desktop flow?

A: Yes, the communication between the cloud and the desktop agent is encrypted. However, ensure that you are using the appropriate roles in your environment so that only authorized users can trigger these flows.

Not read yet

Troubleshooting Checklist

When your cloud-to-desktop flow fails, follow this checklist to isolate the problem:

  1. Check the Run History: The cloud flow run history will tell you exactly which step failed. If it failed at the "Run a flow" step, click it to see the error message.
  2. Verify Machine Status: Is the machine online? Is the Power Automate agent running in the system tray?
  3. Check Credentials: Did the password for the service account change recently? This is a very common cause of sudden failures.
  4. Test Locally: Open the desktop flow directly in the designer and run it manually. If it fails here, the problem is in your desktop flow logic, not the cloud-to-desktop connection.
  5. Review UI Selectors: If the flow fails at a specific UI action, open the UI element selector in the designer and verify that it still matches the application window.

Key Takeaways

After completing this lesson, you should be able to confidently integrate cloud-based workflows with local desktop tasks. Remember these core principles:

  • Orchestration is Key: Use cloud flows to manage the "flow" of data and desktop flows to execute the "tasks." Never try to force an API-based task into a desktop flow, and never try to force a UI-based task into a cloud flow.
  • Resilience Matters: Always build your desktop flows with error handling and smart waiting mechanisms. A flow that works 90% of the time is often useless in a production environment; aim for 100% reliability through robust exception handling.
  • Security First: Use dedicated service accounts for unattended automation. Never store credentials in plain text, and always follow the principle of least privilege.
  • Modularity: Build small, reusable components. This makes your automation easier to debug, maintain, and scale as your business requirements evolve.
  • Monitoring: Use logs and notifications to keep track of your automation health. If a flow fails, you should know about it before the end-user does.
  • Licensing Awareness: Always be conscious of the licensing requirements for unattended vs. attended automation to avoid unexpected billing or service issues.
  • Documentation: Maintain documentation for your flows, especially the dependencies (e.g., "This flow requires the Accounting App to be installed on the machine"). This is invaluable for team members who might need to support your work in the future.

By mastering the connection between cloud flows and desktop flows, you unlock the ability to automate virtually any business process, regardless of whether the software is modern or legacy. This hybrid approach is the hallmark of a professional automation developer. Continue to practice by building small integrations, and you will soon find that you can solve complex business problems with ease and precision.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.