Any way to get rid of new Queue items from previous day via code?

Hi Guys,

The process, we are running works through 50 records each day from the Queue.

Scenario:
Assuming today after 10 records the process fails, there are 40 records which are still in New status. When the process runs tomorrow, we have to process the 50 records and not the 40 records which are still sitting in the queue in “New” status.

The logic need to be like if there are any pending items in new status from previous day, delete them(or ignore those from processing next day by some way), and then adds new items to the queue.

I understand only way to move queue item to in-progress is by getting that transaction item and that way it can be added again with new status and processed the next day.

However, I would like to know if there are better ways of achieving this?

Please note: bot/user doesn’t have delete privileges on queue.

Regards
Sonali

Hi,

you could get all the relevant Queue Items through Get Queue Items activity, then use the Delete Queue Items activity.

1 Like

Hi @lukasziebold,

Yes that’s the easiest and quickest way for sure :slight_smile:

However, lets consider a scenario - bot/user doesn’t have delete privileges on queue.

Regards
Sonali

Uff. I’d recommend asking for the delete privileges…

But if you must you could still get one Queue Item, set its status to failed and repeat. Would that help?

Hi @lukasziebold,

We are not preferring delete queue items approach as a best practice and few other reasons.

Yes, other approach is there to
get queue items with new status
get transaction items - this moves them to Pending status
set txn status for items to fail
But this will increase the rate of failed items upon looking at queue… hence we are still thinking if there can be aby better approach to this.

Regards
Sonali

Sorry, I don’t know how to get rid of the items without getting rid of the items…

You could:

  • not add new items and instead retry the failed items and try the new items from yesterday
  • add new items but filter out items from yesterday - eventually they should go to Abandoned status
  • ask UiPath Tech support for a custom solution

@sonaliaggarwal47

Add Reference as current date while adding items to the queue. Then apply filter strategy to fetch today added items.

1 Like

Hi @sonaliaggarwal47

Another way i found is

  1. Use get queue items activity to get all queue items in the queue,
  2. I think u can filter the queue items by the date
    image
    (not much sure), filter by the yesterday date so that u can get the queue item created yesterday

Then u can change the status from new to anything else using Set Transactional progress option.

By this u can skip out the previous queue items as well

Regards,
Nived N
Happy Automation

1 Like

@sonaliaggarwal47
adding on,

check the orchestrator API as well, as i feel, there would be way to acheieve this as well

Regards,
Nived N

we do feel that this scenario can be handled with many options

process is failing

  • catch all any exceptions / end states by try / catch Global handler and set every remaining WorkQueue item to the status of your choice

Or

  • get with Get QueueItems or by Api only QueueItems of today

Or

  • Once with Get Transaction Item is retrieved check if it is todays item and close it if its not

Or

  • Run a sceduler End of the day and handle every reamining item, so taht it iwll not processed by tomorrow by opening / closing it with status of your choice

Feel free to use Activity or API

1 Like

Hi @sonaliaggarwal47 ,

You can use also use below approach, I have recently used this in my process.

Steps:

1 - Use Get Transaction to read new transaction and make them as Failed with BE exception (you can put message accordingly)

2 - For Pending items you can use GetQueueItem (for pending items) activity and loop each item and mark them failed.

Thanks.

1 Like

Thank you guys for wonderful suggestions :slight_smile:

We finally used an approach to fetch queue items and mark them with proper BE message.

Also adding current date under reference that suits our requirement as later on we have to re-process the items that dint get process. So adding date helps to quickly refer which day items dint get processed and just process those directly.

Once again thank you for all amazing solutions you provided.

Regards
Sonali

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