Web Store Order Processor Using Work Items

An example robot of creating multiple output work items in a process.

MS Excel

This robot splits orders by customer from an incoming Excel file. The orders are then handled individually and in parallel. It includes a second version of the consumer task which produces errors, which can be used to demonstrate how the Control Room receives errors from bots.

The robot demonstrates the Work Items feature of Robocorp Control Room:

  • Triggering a process with custom payloads (input)
  • Passing data and files between process steps
  • Parallel execution of steps
  • Robot and Control Room exception handling

We recommended checking out the article "Using work items" before diving in.


The robot is split into two tasks, meant to run as separate steps. The first task generates (produces) data, and the second one reads (consumes) and processes that data. A bonus task exists which can be used to mock Control Room and Robot error handling.

Producer-consumer, Wikipedia.

The first task (the producer)

  • Reads an Excel file from the work item
  • Splits it into orders by customer
  • Creates a new work item for each order

The second task (the consumer)

  • Logs in to the web store
  • Reads the products in the order from the work item
    • Loops through work items to avoid time spent logging in per each work item.
  • Orders the products

The bonus task (error mocking)

  • Produces errors during the same actions as the consumer.
    • Some error will be retried by the bot internally.
    • Some errors will cause the run to fail after work items are already released (therefore the work item will still complete).
    • Some errors will be reported at the Control Room level with appropriate codes and messages.
  • You can automatically retry errors with the Retry Bot in the Portal.

Excel input file

The first task expects an Excel file in a specific format:

Sol HeatonSauce Labs Bolt T-Shirt3695
Gregg ArroyoSauce Labs Onesie4418
Zoya RocheSauce Labs Bolt T-Shirt3013
Gregg ArroyoSauce Labs Bolt T-Shirt4418
Camden MartinSauce Labs Bolt T-Shirt1196
Zoya RocheSauce Labs Fleece Jacket3013
Zoya RocheSauce Labs Onesie3013
Sol HeatonSauce Labs Fleece Jacket3695
Sol HeatonSauce Labs Onesee3695

But, you can run this as a demo by supplying no item to the Control Room. The robot will use the default input used in testing and linked above.

Local development

When running in Control Room, the work items will be automatically managed and passed between steps in the process. However, when running locally, the work items can be simulated using folder structure and JSON files.


Robocorp VsCode extensions has built-in support making the use and testing of work items more straightforward.

Note: This requires the use of rpaframework v12.8.1 or later in your robot.

Using VsCode, you should only need this guide

Robocorp Lab and RCC from CLI

As each task in the robot expects different work item input, we need a way to control this.

This example includes test inputs, one for each task in the process:

  • For task Split orders file:
    • ./devdata/work-items-in/split-orders-file-test-input/work-items.json
  • For task Load and Process All Orders:
    • ./devdata/work-items-in/process-orders-test-from-outputs/work-items.json

The RPA.Robocorp.WorkItems library can be controlled with specific environment variables to control the input and output sources. In this example under ./devdata you can find three different JSON files that demonstrate the selection:

  • env.json: This is used as default by Robocorp Lab and RCC command-line and points to the input for task Split orders file
  • env-process-orders.json: Points to the input for task Load and Process All Orders
  • env-split-orders.json: Points to the input for task Split orders file

By default the env.json is used by Robocorp Lab so the inputs and output paths defined there decide which input is used. You can edit that file change what you are testing.

To run specific tasks with specific inputs in the command-line or Robocorp Lab Terminal you can run the following commands:

  • Run Split orders file with test input:
    • rcc task run -t "Split orders file" -e ./devdata/env-split-orders.json
  • Run Load and Process All Orders with test input:
    • rcc task run -t "Load and Process All Orders" -e ./devdata/env-process-orders.json

Control room setup

To see how to set up Control Room and understand more about how work items are used, see the following article: Using work items.