How to upload\consume the bulk data to\from queue?

How to upload and get the bulk data (Datatable or other object) to and from a queue in Orchestrator ?

Pre-requisite:

  1. Studio - Import Newtonsoft.Json namespace:

image.png

  1. Robot - Provision the bot to the Orchestrator
  2. Orchestrator - Ensure that a queue exists in the same folder as the user that is provisioning the Robot.


Step by step guide:

To upload a bulk data like an Excel with 50 columns and 1000 rows, there is always a need to create 50 arguments(columns) to the Add Queue Item activity. It has to be hard-coded and needs an eye whenever there it needs a modification. As there is no explicit way of adding a bulk data to queue, following is one of the ways to upload and consume them back:

Adding items to queue:

  1. Serializing the datatable as JSON: Assign String strJson = JSONConvert.SerializeObject(dt)
  2. Add strJson in the queue as argument with some name (Say arg1) using Add Queue Item activity

Where dt is a datatable to be uploaded in the queue.


Consuming from queue:

  1. Get the item from queue using Get Transaction Item activity and save to (transItem) variable of type UiPath.Core.QueueItem
  2. Assign : strJson = transItem.SpecificContent("arg1").ToString
  3. Deserialize the strJson back to datatable using Deserialize JSON activity with TypeArgument as Datatable

From Studio 18.4.5 onwards:

An activity Bulk Add Queue Item with the UiPath.System.Activities starting in v19.4.0

Release Notes: Activities


Note: The above steps are applicable to upload/download whole Excel data(DataTable) to / from a single TransactionItem.