This article describes the RPA Queue functionality to get the next unprocessed item from a queue.
For a full list of available functions, please read QUEUE functions.
Description
The Get next item function atomically retrieves and locks the next unprocessed item from a queue. The item is assigned to the current bot and its status changes from "new" to "inprogress". Items are returned in priority order (high first), then by creation date. Deferred items are skipped until their defer date has passed. This is typically used in a performer process loop.
Setting it up
To use the Get next item function, follow these instructions:
{{popups:rpas/add:action=queue-get-next}}
Once on a process map:
- Navigate to the process where you would like to add the function
- Click on the green button’s drop-down (right side of the green button labelled “Process”)
- On the menu that appears, click on the “+ Activity” item
- From here you can select the QUEUE Get next item option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Queue ID | Yes | Text | - | The ID of the queue, or a variable such as {queue_id} |
| Variable | Yes | Text | - | Variable to store the queue item (null if queue is empty) |
Output variables
| Variable | Type | Description |
|---|---|---|
| Variable | Object or null | The queue item with id, reference, specificContent, priority, status. Null if no items available. |
Errors
- Queue not found – if the queue ID is invalid
Tips
- Use this in a loop: get next item, process it, mark complete or failed, repeat until null
- Multiple bots can safely call this on the same queue – each bot gets a different item
- Access the item’s data via {variable.specificContent.fieldName}
- Check if the variable is null/empty to know when to stop the loop