maestro
latest
false
UiPath logo, featuring letters U and I in white

Maestro user guide

Last updated Sep 24, 2025

How to - Complex process

Overview

InsurePath identified an invoice processing workflow with UiPath Process Mining. They use UiPath IXP and Document Understanding to process incoming invoices and extract invoice data. After extraction, the finance and accounting teams still process most invoices manually, including resolving vendor disputes.

The process owner, together with process implementers and administrators, decided to address the invoice processing problem with UiPath Maestro™ and platform capabilities.

Process

Build a working invoice processing process to demonstrate how Maestro coordinates work between robots, agents, and humans.

This is the BPMN diagram for the process we will build.

Prerequisites

We need to configure the dependent resources for this scenario.

Data Fabric: APInvoice entity

Use the Record Created event for the APInvoice entity to trigger the start of our process.
  1. Navigate to Data Fabric and select Import/Export and select Import Schema. Use this file to import.

  2. Select the APInvoice entity to import and select Import.

Orchestrator: Shared Folder

Use a shared folder in Orchestrator to organize the How To resources.

Navigate to Orchestrator and create a Shared/How To folder.

Automation: Invoice to PO matching

Use a mock automation to simulate invoice-to-purchase-order two-way matching. The process takes an input argument for Invoice Number and sets the ResolutionRequired output variable. If the invoice number starts with 1, the value is Yes. Otherwise, it is No.
  1. Navigate to Studio Web and select Import form the Create new drop-down list. Use this file to import.

  2. Open the project in UiPath Studio Web and publish to Orchestrator Tenant Processes Feed.
  3. Navigate to Orchestrator, go to the Shared/How To folder, select the Automations tab, choose Processes, and select Add process.
  4. Select Invoice.To.PO.Matching in Package Source Name and select Next.
  5. In the Package Requirements section, select Next .
  6. Provide Invoice to PO matching for Display Name and select Create.

    See Studio Web Publishing a project for additional details on publishing and deploying projects.

Automation: Post invoice to SAP

Use a mock automation to simulate posting the invoice to SAP. The process takes an input argument for Purchase Order Number and has no outputs. If the purchase order number equals fail, the process throws a runtime exception that you can repair in instance management.
  1. Navigate to Studio Web, and select Import from Create New drop-down list. Use this file to import.
  2. Open the project in Studio Web and Publish to Orchestrator Tenant Processes Feed.
  3. Navigate to Orchestrator, go to the Shared/How To folder, select the Automations tab, choose Processes, and select Add process.
  4. Select Post.Invoice.To.SAP in Package Source Name and select Next.
  5. In the Package Requirements section, select Next .
  6. Provide Post invoice to SAP for Display Name and select Create.

    See Studio Web Publishing a project for additional details on publishing and deploying projects.

Agent: Resolve discrepancies agent
  1. Navigate to Agents and select Build your agent now.
  2. Enter the following details:

    Name: Resolve Discrepancies Agent

    Description: Resolve discrepancies agent

    System prompt: You are an expert in Resolving Invoice Discrepancies

    User prompt: If the {{InvNum}} start with 11 you will Resolve the invoice. Else you will reject the invoice and give the {{Reason}} for rejection as Needs human review since the PO Number doesn't match the Invoice.
    When you reject the invoice set {{Decision}} to Rejected and if you approve the invoice set {{Decision}} to Resolved.
  1. Select Arguments and enter the following the using the Editor option:

    Inputs

    {
      "type": "object",
      "properties": {
        "InvNum": {
          "type": "string"
        },
        "PONum": {
          "type": "string"
        }
      },
      "required": [
        "InvNum"
      ]
    }{
      "type": "object",
      "properties": {
        "InvNum": {
          "type": "string"
        },
        "PONum": {
          "type": "string"
        }
      },
      "required": [
        "InvNum"
      ]
    }
    Outputs
    {
      "type": "object",
      "properties": {
        "Decision": {
          "type": "string"
        },
        "Reason": {
          "type": "string"
        }
      },
      "required": []
    }{
      "type": "object",
      "properties": {
        "Decision": {
          "type": "string"
        },
        "Reason": {
          "type": "string"
        }
      },
      "required": []
    }
  2. Publish to Orchestrator Tenant Process Feed.
Action app: Invoice Approval Action App
  1. Navigate to Studio Web, and select Import from Create New drop-down list. Use this file to import.
  2. Open the project in Studio Web and Publish to Orchestrator Tenant Processes Feed.
    Note: You may need to navigate to MainForm_MainForm_load.xaml and update entities. From Data manager, go to Entities, and select Update entities before you can publish.


  3. Navigate to Orchestrator, go to the Shared/How to folder, go to the Automations tab, select Apps and choose Deploy app.

Model an agentic process

Note: Agentic process project configuration is currently tenant-bound. Make sure that you remain in the same tenant between editing sessions.

Start by modeling the end-to-end process, then configure the components.

Create an agentic process as a new type of Studio project.

  1. Navigate to your Automation Cloud™ tenant.
  2. On the rail on the left side, from the list of products, select Maestro.
  3. On the Maestro landing page, select Start modeling. Your new agentic process opens.
    Tip: You can also start by creating a new Agentic Process in Studio Web.

  4. Right-click to rename the project to {your initials} Invoice Process, and the process to Invoice Process.

  5. Select the start element and type Invoice received in the name field.
  6. Click Add: Text annotation from the toolbox. Type Data Fabric trigger in the annotation.

  7. Select the start element and choose Add Task from the toolbox and type Invoice to PO matching for the task name.

  8. Select the Invoice to PO matching task and click Add: Text annotation from the toolbox and type Automation to indicate we want this to be an automation task.

Invoice to PO matching outgoing paths

Configure two outgoing paths for the gateway of which only one will be followed based on the outcome from the Invoice to PO matching automation.

  1. Select the Invoice to PO matching task and click Add: Exclusive gateway from the toolbox and type Is resolution required? for the name.

  2. Select the gateway and choose Add: Task from the toolbox and type Invoice approval for the name. Add Action Center Action app as an annotation to indicate we want this to be a HITL task.
  3. Select the line just created between the gateway and task and press the Open properties panel button in the upper right-side of the designer to change the name to No.

  4. Select the gateway again and choose Add: Task from the toolbox and type Resolve discrepancies for the name. Drag and position the task under the gateway. Add Agent as an annotation to indicate this will be an agent task.
  5. Select the line just created between the gateway and task and open the properties panel to change the name to Yes.

Invoice approval outgoing paths

Configure two outgoing paths for the gateway of which only one will be followed based on the outcome from the Invoice approval task done by the human.
  1. Select the Invoice approval task and add another Exclusive gateway.
  2. Select the gateway, choose Add: Task from the toolbox, and type Post invoice to SAP for the name. Add Automation as an annotation to indicate that you want this to be an automation task.
  3. Select the line just created between the gateway and task and open the properties panel to change the name to Approve.
  4. Select the gateway again, choose Add: Task from the toolbox and type Notify vendor for the name. Drag and position the task under the gateway. Add Integration Service Outlook connector as an annotation to indicate this will be an API call indicated as a Send task.
  5. Select the line just created between the gateway and task and open the properties panel to change the name to Reject.

Resolve discrepancies outgoing paths

Configure two outgoing paths for the gateway. Only one will be followed based on the outcome from the Resolve discrepancies task done by the human.
  1. Select the Resolve discrepancies task and add another Exclusive gateway.
  2. Select the gateway and choose the Connect arrow from the toolbox.

  3. Select the Notify vendor task to draw a line from the gateway to task.

  4. Select the line just created between the gateway and task and open the properties panel to change the name to Rejected.
  5. Use the Connect tool again to draw a line from the gateway to the Invoice approval task.
  6. Select the line just created between the gateway and task and open the properties panel to change the name to Resolved.

Resolve discrepancies error boundary event

If the agent cannot resolve the discrepancy, it will return a business error, routing the task back to a human for further input. Model this by adding an Error boundary event to the task.
  1. Select the Intermediate event in the full toolbox on the left-hand side and drag-n-drop it to the Resolve discrepancies task.



  2. Select the Intermediate event and choose Change element from the toolbox and select Error boundary event.

  3. Select the Error boundary event, choose Add: Task from the toolbox, and type Resolve discrepancies for the task name. Add Action Center Action app as an annotation to indicate we want this to be a human-in-the-loop task.
  4. Select the new Resolve discrepancies task. Use the Connect tool again to draw a line from the this new task to the agent gateway.

End events

It is a best practice to create an explicit end to your process. It's important to quickly know which path your process followed so you can create an explicit end for each one.
  1. Select the Post invoice to SAP task, choose Add: End event, and type Invoice processed for the name.
  2. Select the Notify vendor task, choose Add: End event, and type Invoice rejected for the name.`

Congratulations! You’ve created your first BPMN end-to-end business process. It's time to add some UiPath capabilities to the process.

Implement an agentic process

Message start event

  1. Select the start element, choose Change element from the toolbox, and select Message start event.

  2. Open the properties panel and in the Implementation section configure the following:
    • Action: Wait for connector event.
    • Connector: Data Fabric
    • Data Fabric connection: Data Fabric.
      Note: Choose Connect to Data Fabric to create a connection you don’t have one already.
    • Trigger: Record Created.
    • Object: APInvoice.
    Note: All outputs will be automatically available as variables in the process configuration.
    Note: If you are in a shared environment, you can change the Trigger to Record Updated and configure the filter to set CreatedBy E-mail equal to your email.

Invoice to PO matching automation

  1. Select the Invoice to PO matching task, choose Change element from the toolbox. and select Service task.
  2. Open the properties panel and in the Implementationsection configure the following:
    • Action: Start and wait for RPA workflow.
    • Automation: Invoice to PO matching.
  3. Configure the inputs by mapping the output from Invoice received message start event as inputs to the automation. Use the Variable search dialog to find the variables.
    • InvNum: Invoice received > response > Invoice number.

    • PoNum: Invoice received > response > PO number

The Is resolution required? gateway

  1. Select the Is resolution required? gateway, expand the Conditions to enter the condition for the No and Yes paths, and use the Expression editor to enter the conditions.

  2. Use Insert variable to find and insert Invoice to PO matching output variable ResolutionRequired, set the value to “No”, and select Save.

  3. Alternatively, you can simply copy/paste the expressions below into expression editor:
    1. No: vars.ResolutionRequired == "No"
    2. Yes: vars.ResolutionRequired == "Yes"

Approve invoice task

  1. Select the Approve invoice task, choose Change element from the toolbox, and select User task.
  2. Open the properties panel and in the Implementation section and configure the following:
    • Action: Create action app task
    • Action*: Invoice.Approval action app
    • Task title: {your initials} Invoice approval.
  3. Configure the inputs by mapping the output from Invoice received message start event as inputs to the app task. Use the Variable search dialog to find the variables for the Data Fabric record Id.
Resolve discrepancies task
  1. Select the Resolve discrepancies, choose Change element from the toolbox, and select Service task.
  2. Open the properties panel and in the Implementation section, configure the following:
    • Action: Start and wait for agent.
    • Automation: 2-way matching agent.
  3. Configure the inputs by mapping the output from Invoice received message start event as inputs to the automation. Use the Variable search dialog to find the variables.
    • InvNum: Invoice received > response > Invoice number
    • PoNum: Invoice to PO matching > PO number

Resolve discrepancies agent outgoing gateway

  1. Select the gateway and expand the Conditions to enter the condition for the Resolved and Rejected paths and select the text entry picker to Open expression editor to enter the conditions.
  2. Copy/paste the expressions below into expression editor.
    1. Resolved - vars.Decision == "Resolved"
    2. Rejected - vars.Decision == "Rejected"

Notify vendor send task

  1. Select the Notify vendor task, choose Change element from the toolbox, and select Send task.
  2. Open the properties panel and, in the Implementation section, configure the following:
    • Action: Integration Servies - API execution
    • Connectors: Microsoft Outlook 365
    • Connection: {your outlook connection}
      Note: Select Connect to Microsoft Outlook 365 if you don’t already have a connection available.
    • Activities: Send email
    • Trigger: Email sent
  3. In the Filter section, configure the Primary inputs for the Send email activity:
    • To: {Invoice received > response > Invoice email}
    • Subject: Invoice rejected
    • Body: Invoice rejected because {Resolve discrepancies > message}


Approve invoice outgoing gateway
  1. Select the gateway and expand the Conditions to enter the condition for the Approve and Reject paths and select the text entry picker to Open expression editor to enter the conditions.
  2. Copy/paste the expressions below into expression editor:
    • Approve: vars.Action == "Approve"
    • Reject: vars.Action == "Reject"
Post invoice to SAP automation
  1. Select the Post invoice to SAP, choose Change element from the toolbox, and select Service task.
  2. Open the properties panel and in the Implementation section configure the following:
    • Action: Start and wait for RPA workflow
    • Automation: Post Invoice to SAP.
    • Configure the inputs by mapping the output from Invoice to PO matching task as inputs to the automation.
      • PurchaseOrderId: fail
      Note: We want this automation to fail so that we can fix runtime later.

Congratulations! You’ve now fully configured your first agentic process.

It's time for some debugging.

Debug a business process

Debug scenarios
  • Invoice Number starts with x > No resolution required, go to Invoice Approval human-in-the-loop.
  • Invoice Number starts with 1x > Resolution required, go to Resolve Discrepancies Agent, Agent rejects.
  • Invoice Number starts with 11 > Resolution required, go to Resolve Discrepancies Agent, Agent resolves.
  1. On the top-left of the page, select Debug step-by-step.

    Note: You can select Test configuration to confirm the input variables and connections used in the project.
  2. Hover to the left of the Invoice to PO matching task and select to add a breakpoint.

    Note: Configure breakpoints for your End events. This offers you enough time to inspect all variables before finishing the debug session.
  3. Select Next step to move the execution past the Message start event.
  4. Update the response Global variable for the Invoice received Message start event with the following response object, then select enter or tab to commit the change:
    {
        "Currency": "USD",
        "DueDate": "2025-02-14",
        "InvoiceDate": "2025-02-14",
        "InvoiceEmail": "[email protected]",
        "InvoiceNumber": "12345",
        "PONumber": "4551232",
        "TotalAmount": 10000,
        "VendorName": "Acme",
        "Source": 1,
        "Status": 6,
        "Id": "6F92ECF6-D1EA-EF11-90CB-6045BD93BF30",
        "UpdateTime": "2025-02-14T18:22:40.6233376Z",
        "CreateTime": "2025-02-14T12:48:19.3578548Z",
        "UpdatedBy": {
            "Email": "[email protected]"
        },
        "CreatedBy": {
            "Email": "[email protected]"
        }
    }{
        "Currency": "USD",
        "DueDate": "2025-02-14",
        "InvoiceDate": "2025-02-14",
        "InvoiceEmail": "[email protected]",
        "InvoiceNumber": "12345",
        "PONumber": "4551232",
        "TotalAmount": 10000,
        "VendorName": "Acme",
        "Source": 1,
        "Status": 6,
        "Id": "6F92ECF6-D1EA-EF11-90CB-6045BD93BF30",
        "UpdateTime": "2025-02-14T18:22:40.6233376Z",
        "CreateTime": "2025-02-14T12:48:19.3578548Z",
        "UpdatedBy": {
            "Email": "[email protected]"
        },
        "CreatedBy": {
            "Email": "[email protected]"
        }
    }


  5. Select the expander to inspect and/or further change the values.

  6. Select Update 1 variables and Update variables in the dialog to commit the changes.
  7. Select Next step or Continue to move the execution to the end with the new values.

Congratulations! You’ve fully debugged your first agentic process.

It's time to s publish and deploy your process.

Publish and deploy a business process

  1. Select Publish to publish the process.

  2. Navigate to Orchestrator, and in the Automations tab, and select Add process.

  3. On the Connect to Microsoft Outlook 365 screen, select Connect.
  4. Use your email credentials to complete the connection. The new connection will be automatically selected,.

  5. Select Next.
  6. Enter {your initials} Invoice Processing for the Display Name and choose Create.

Congratulations! You’ve now fully deployed your first agentic process!

It's time for some runtime instance management.

Manage a business process

  1. Navigate to Maestro home page.
  2. In the Process instances view, choose {your initials} Invoice Processing to open the All instances view for your process.

  3. You can select the model background to see Global variables, Incidents, Action history, as well as the Execution trail. You can select a node in the model or the Execution trail to inspect Details and Variables for that execution step.
    Note: You need to action any human-in-the-loop steps in Action Center if execution is paused there.

p

Congratulations! You’ve fully managed your first agentic process,

It's time to fix your broken process.

Fix a business process

For this exercise, cause a failure in execution so you can use the instance management to recover.

Prepare failed instance
  1. Open a new Tab and navigate to Data Fabric > APInvoice > Data and add a record that has Invoice Number that starts with 2xxxx to ensure we get to the Post invoice to SAP step.
    Note: If you are in a shared environment, you can use an existing record that has CreatedBy E-mail that matches the filter you configured.
  2. Navigate to your process All instances page, select the refresh button for the list and choose the latest instance.
  3. When the execution is paused on a human-in-the-loop step, you must open Actions (formerly Action Center) to assign and complete the task.

  4. Open a new browser tab and select Actions in the left navigation menu.



  5. Select Inbox, then go to Unassigned.
  6. Find and select your task and choose Assign to self.

  7. Find your task in Pending and select Approve once the form load.
Fix failed instance
  1. Go back to your agentic process tab, wait for Post invoice to SAP step to fail, and select on the node or the execution step. Note the Errors and Variables.
  2. Update the variable to fix the input by changing ‘fail’ to ‘1234’ and select Save.
  3. Select Update 1 variable to update the variable and add a Comment.
  4. In the Action History tab, select Retry, add a comment and choose Retry instance to retry the step with the new variable. Watch the instance complete.

Congratulations! You successfully fixed a broken instance.

Migrate to a new version of a business process

Fix the issue created in the previous section so it doesn’t happen again.

Prepare failed instance

  1. Open a new Tab and navigate to Data Fabric > APInvoice > Data and add a record that has Invoice Number that starts with 2xxxx to ensure we get to the Post invoice to SAP step.
    Note: If you are in a shared environment, you can an existing record that has CreatedBy E-mail that matches the filter you configured.
  2. Navigate back to your to All instances page, select the refresh button for the list and choose the latest instance.
  3. When execution is paused on a human-in-the-loop step, you must open Actions (formerly Action Center) to assign and complete the task.
  4. Open a new browser tab and select Actions in the left navigation menu.
  5. Select Inbox, choose Unassigned, select your task, and choose Assign to self
  6. Find your task in Pending and select Approve once the form loads.
  7. Go back to your Maestro tab, wait for the Post invoice to SAP step to fail, and then select the node or the execution step.
Update process version for repair
  1. Open {your initials} Invoice Processing process in UiPath Studio.
  2. Fix the broken Post invoice to SAP step by configuring a PO number as input.
  3. Select the Post invoice to SAP and open the properties panel.
  4. In the Inputs section configure the inputs by mapping the output from Invoice to PO matching task as inputs to the automation.
    • PurchaseOrderId: Invoice to PO matching > PoNum.
  5. Publish the process to the Tenant feed.
  6. Find your process in Orchestrator and select Upgrade to latest version from the menu.
  7. Navigate back to Maestro, go to your process and your running instance.
  8. This time, instead of fixing the variable, use the Migrate option.
  9. Select the new version of your process, add a comment, and choose Migrate instance.

  10. Now you need to inform the engine to continue processing on the new version. Select Retry, add a comment, and choose Retry instance to continue execution which will now complete successfully.

Congratulations! You’ve successfully migrated a running instance to a new version.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo
Trust and Security
© 2005-2025 UiPath. All rights reserved.