How to get a queue items 'value'?

I’m uploading to a queue in Orchestrator and then I want to pull that item value. I’m doing it like this but it’s not working:

Both write line activities return UiPath.Core.QueueItem but I’m looking for the value, 1234 in this case.

2 Likes

The values will be under QueueItem.SpecificContent("ContentName"), where ContentName is the name of the variable you used to store the data. If the data stored is a Reference, then you use QueueItem.Reference to get the data.

4 Likes

Hello @Anthony_Humphries what do I type into the write line if i want to get the value?

QueueItem.SpecificContent("ContentName").ToString, where ContentName is the name of the variable you used to store the queue contents, or QueueItem.Reference.ToString if the data is stored as a reference.

4 Likes

Are you sure? I’m getting the following message:

*Compile error(s) encountered processing expression *
“QueueItem.SpecificContent(“ContentName”).ToString”.
Reference to a non-shared member requires an object reference.

Here is a screenshot
SS3

If you’re literally passing “ContentName”, this will not work. You need to know the name of the content stored in the Queue. This is something I cannot provide.

Got it! I assume this to be the variable name i used to add to the queue initially.

Yes, that’ll be the right one.

The “ContentName” is inside double quotes and thus has no effect. The error message still appears regardless of what i type to replace ContentName.

@michaelamay0

What is the name of the variable output by the Get Transaction Item? TransactionItem?
In the parentheses, you put the name of the specific data you want to retrieve. InputValue?

variableName.SpecificContent("InputValue").ToString

I am unable to use the ‘specific content’ for the queue to list down the values of the different items.I need to get the details of the particular variable from all queue items.

Error:
The given key was not present in the dictionary.

Is the item in Assets_List of type QueueItem? If that is a list of strings, you need to fetch the transaction item first and get the specific content from that.

image
it is an array of queue items … i guess that is what is required for ‘get queue items’ activity

In that case, the error means that the data was not loaded such that there is a “User” specific content loaded into the queue. This either has to be specified in the collection of arguments loaded into the queue, or it has to be the name of one of the columns when loading the data with Add Bulk Queue Items.

During the data upload in the queue the column name was present as “User”,This is also the same as visible in the orchestrator.

There seems to be a fair bit of consternation about the correct answer on how read UiPath queues and get a UiPath QueueItem value. With the latest version of UiPath Orchestrator and Studio as of September 2020, the code to do it assuming you were getting the value for a key named ‘email’, is:

item.SpecificContent("email").ToString

To further demonstrate, I put this image together. You can see the item in the queue in UiPath Orchestrator with the email and status fields, and you can see the call to extract it from the UiPath project in Studio.

Finally, you can see the output from running the UiPath robot in the console, showing how the output maps to the SpecificContent call which maps to the data in the QueueItem on the server.

Hope this help.

5 Likes