# Deleting all the existing workitem before a bot starts

**URL:** <https://discourse.openiap.io/t/deleting-all-the-existing-workitem-before-a-bot-starts/3329>\
**Category:** OpenRPA\
**Created:** [September 4, 2026, 9:59am UTC](https://discourse.openiap.io/t/deleting-all-the-existing-workitem-before-a-bot-starts/3329 "2026-09-04T09:59:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nws\_hp](https://discourse.openiap.io/letter_avatar_proxy/v4/letter/n/7ab992/32.png) [@nws\_hp](https://discourse.openiap.io/u/nws_hp)\
**Post date:** [September 4, 2026, 9:59am UTC](https://discourse.openiap.io/t/deleting-all-the-existing-workitem-before-a-bot-starts/3329/1 "2026-09-04T09:59:39Z")

</div>

Hi Team,

I have gone through this topic

> [@Delete all workitems from queue in Openrpa flow automaticaly](https://discourse.openiap.io/t/delete-all-workitems-from-queue-in-openrpa-flow-automaticaly/889):
>
> Hi! In Openrpa flow, before robot starts to add new workitems in queue, I have to clear a queue from old workitems. It is possible in Openflow and Openrpa manually with “Purge” command. Is it possible to do it automatically in some sequence of flow, and what it will be the best practice? Maybe someone had such experience? Thanks

but i need more steps how to do it using both the ways.  
or is there any other workaround to do it by using pop workitem ?

---

<div class="post-metadata">

**Author:** ![Evelio87](https://discourse.openiap.io/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@Evelio87](https://discourse.openiap.io/u/Evelio87)\
**Post date:** [September 9, 2026, 8:31pm UTC](https://discourse.openiap.io/t/deleting-all-the-existing-workitem-before-a-bot-starts/3329/2 "2026-09-09T20:31:00Z")

</div>

Hello,

From my experience, a workaround could be:

- Create a helper workflow like “Clear Queue”.
- Inside a loop, pop the next workitem from the queue to a IWorkitem temporal variable:
  - If it is not null → then update its status to Abandoned
  - If null → exit the loop

- Call this new workflow from your automation workflow.

I hope this give you an idea

---

<div class="post-metadata">

**Author:** ![nws\_hp](https://discourse.openiap.io/letter_avatar_proxy/v4/letter/n/7ab992/32.png) [@nws\_hp](https://discourse.openiap.io/u/nws_hp)\
**Post date:** [September 10, 2026, 6:51am UTC](https://discourse.openiap.io/t/deleting-all-the-existing-workitem-before-a-bot-starts/3329/3 "2026-09-10T06:51:13Z")

</div>

Thanks it worked!!

 ![image](https://discourse.openiap.io/uploads/default/original/2X/6/6dbdae8e56eaae2ab02c2372df0ca3ce9edc1031.png)

---

<div class="post-metadata">

**Author:** ![system](https://discourse.openiap.io/uploads/default/original/2X/a/a1ca7b164ac9a826839704d9ac82c7b5e6bcf557.png) [@system](https://discourse.openiap.io/u/system)\
**Post date:** [September 13, 2026, 6:52am UTC](https://discourse.openiap.io/t/deleting-all-the-existing-workitem-before-a-bot-starts/3329/4 "2026-09-13T06:52:06Z")

</div>

Closed on September 13, 2026, 6:52am UTC

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