Unable to Iterate through Queue Items

Hi,
I know this is a repetitive topic but I had to add this as a new topic as the solutions provided for the similar topic were not helping me out.

I am using a “for each” loop to iterate through the queue items from get transaction but I am getting error(snip below), as a resolution for previous similar posts I already tried changing the argument type of my “For each” loop to “uipath.Core.queueitem” but still the error persists.

Sure, there must be some easy catch for this.

Any help will be appreciated.

1 Like

@Faraz_Subhani

Once go to ForEach loop Activity properties and check what you declared argument type. It must be UiPath.Core.QueueItem. Please do changes and then try it.

1 Like

Thanks for the prompt response, as I mentioned in my post I have already set the arguments property to UiPath.Core.QueueItem.

2 Likes

Get Transaction Item returns a QueueItem and not a collection of items from the Queue.
Get Queue Items return IEnumerable<QueueItem>.

@Faraz_Subhani, include @lakshman point, and make sure you have the only one For Each activity in your activity pane. If two found then use the another activity. I do handle that same issue before.

But the Property argument type is very important.

TanQ,
Michael Udhaya

@KannanSuresh Absolutely correct and here I want to iterate through the queue items generated by Get Transactions @Michael_Udhaya Property argument type is already set to QueueItem but yes I am using 2 for looops in same activity, one for iterating through Data table and the other for iterating through queueItems. Attaching my workflow, it’s very simple oneMain.xaml (9.5 KB)

@KannanSuresh , I’m mentioned that activity (it was different For Each Row). I told you have two activity in same name For Each.

Or you can use the do while loop to iterate all the item with it’s index (like we did in UiPath Advanced Training).

TanQ,
Michael Udhaya

I checked your process file. You are using the activity Get Transaction Item and saves the output in OutputQueue.

As I said before, the OutputQueue contains a single Queue Item, not a collection of items in your queue.

If you want to retrieve all items in your queue, use Get Queue Items activity.

1 Like

I totally get your point and yes it works fine when I am using Get Queue Items, So, please correct me if I am wrong, Get Transaction item’s output will only contain a single queue item and not a collection of Entire Queue items which can be iterated and if we want to iterate through entire Queue items we need to use Get Queue Items.
Please may I know then the exact usage of Get Transaction Items? Is It only used to set transaction status for individual queue items?

It is not Get Transaction Items it is Get Transaction Item. (Item not Items)

Gets an item from the queue so that you can process it (start the transaction) and sets its status to In Progress. Please note that to execute this activity, the Robot role needs to have view, edit, and create permissions on transactions, as well as view and edit permissions on queues. The activity runs under the Robot it executes it.

If the queue is empty, the following error is thrown upon accessing the retrieved TransactionItem : System.Exception: Object reference not set to an instance of an object.

Thank You very much, that cleared all my queries.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.