How can i increment an integer parameter present in the queue item

I have added a variable named Retry count to the collection of “Add Queue Item” activity with value as 0. So that this be one among the parameter for every transaction item. I need to increase the value of this parameter by 1, whenever this queue item gets executed. When it reaches 3, i need to stop retrying.(This is done using Postpone activity) but how to increment this transaction parameter.

1 Like

@Athulya_S_Chandran

We can’t modify the values in Queue Item post item got added. We can change the status only.

If we want to do so then you need to add one more new item to the queue by changing status to previously added item.

Hey @Athulya_S_Chandran

We already have the retry param for a queue item which can be utilised ?

I don’t think utilizing queue data for this is a good idea

Thanks
#nK

Hello @Athulya_S_Chandran ,

Instead of adding a separate column for the Counter, what you can do is use the existing retry machanism in the Reframework. If you are not going to use Re-framework after getting the Queue item, you can create a local variable and name it as counter initialize it as 0. Then increment that counter till 3 using a while loop.

@Athulya_S_Chandran We can’t modify the data through studio once the data is loaded to the queue . You can make this change in the code itself. If any exception occurs increment the counter in the catch block. If the counter is equal to 3 then don’t retry that transaction

You can set the value in the transaction as you’re processing it, but this does not affect the actual Queue Item.

Assign yourTransactionVar.SpecificContent(“Retry Count”) = CInt(yourTransactionVar.SpecificContent(“Retry Count”).ToString) + 1

So that’ll update the value as your automation sees it, but it DOES NOT update it in the queue.

Hi @Athulya_S_Chandran,

There are two things I love about Blue Prism.

  1. Ability to modify queue item data whenever there is a need for it, be it troubleshooting or debugging
  2. Process logs which can trace easily where the exception occurred

Your question relates to Point 1. Sadly, as many have pointed out already, you cannot change the item when the item is picked from the queue i.e., the item is in-progress in UiPath :frowning:

To achieve what you want simply set a max retry value when you created a queue. That retry number is automatically ingested in each transaction item and considered by the Process Transaction state in the REFramework. The item will only be tried n times as you set in the queue. REMEMBER: This value will be overwritten by the MaxRetryNumber in the config.xlsx file, so it is very important you set the value to 0 in your config.xlsx file.

In short, the sharp end i.e., MaxRetryNumber in your project config.xlsx takes priority over the Max Retry setting of the queue.

There is a way
In addition, Yes there is a way to copy the Specific Content from an item, but once you manipulate it, you will have to reupload the Dictionary(String,Object) back to queue, which essentially means you will end up adding a new item and not editing the original item. We have done this when we had to ingest queue items and add some specific content and re-dispatch new updated items to the same queue.

the input from above strongly recommends to check if the retry mechanism can be used / made usable for you.

For updating the specific content with ORC API we have to take care about few things
e.g. Why after updating a queue item with odata/QueueItems(Id) SpecificContent is lost?

You can check if the coupling set Progress and Postpone can be used for reflecting what you want to express