# Script to flush store and forward

**URL:** <https://forum.inductiveautomation.com/t/script-to-flush-store-and-forward/19968>\
**Category:** Ignition\
**Created:** [October 3, 2018, 8:24pm UTC](https://forum.inductiveautomation.com/t/script-to-flush-store-and-forward/19968 "2018-10-03T20:24:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [October 3, 2018, 8:24pm UTC](https://forum.inductiveautomation.com/t/script-to-flush-store-and-forward/19968/1 "2018-10-03T20:24:14Z")

</div>

Is there a way by script to flush the store and forward quarantine data (as we can manually do with the gateway web page)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 3, 2018, 8:31pm UTC](https://forum.inductiveautomation.com/t/script-to-flush-store-and-forward/19968/2 "2018-10-03T20:31:36Z")

</div>

You can, but you’ll need a module to get access to the gateway context (in any semi-sanctioned way, that is)  
From GatewayContext, get the history manager with `context.getHistoryManager()`, then `getQuarantinedDataInfo(<storeName>)`; then get the ID from each quarantined item.  
Then from the history manager, call `deleteQuarantinedData(<storeName>, <idsToDelete>)`.

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [October 4, 2018, 7:02pm UTC](https://forum.inductiveautomation.com/t/script-to-flush-store-and-forward/19968/3 "2018-10-04T19:02:36Z")

</div>

```auto
name = "ignition"
if not initialChange:
	from com.inductiveautomation.ignition.gateway import SRContext
	from java.lang import Long
	context = SRContext.get()
	qi = [Long(qdi.id) for qdi in context.historyManager.getQuarantinedDataInfo(name)]
	context.historyManager.deleteQuarantinedData(name,qi)

```

Quick example of how you could do this. This has to run from the gateway.
