# Pre processing of document events

**URL:** <https://community.bloomreach.com/t/pre-processing-of-document-events/2079>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [August 27, 2020, 7:30am UTC](https://community.bloomreach.com/t/pre-processing-of-document-events/2079 "2020-08-27T07:30:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![epineight](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/epineight/32/790_2.png) [@epineight](https://community.bloomreach.com/u/epineight)\
**Post date:** [August 27, 2020, 7:30am UTC](https://community.bloomreach.com/t/pre-processing-of-document-events/2079/1 "2020-08-27T07:30:20Z")

</div>

I know we can listen to document events like is described here: [Respond to Workflow Events](https://documentation.bloomreach.com/14/library/concepts/workflow/workflow-events.html)

If i would listen to a delete event I can do some post processing. But I’m not able to do some pre-processing. So before the document actually gets deleted. Is there a way to do that? And is it possible to also abort the delete operation?

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [August 27, 2020, 2:09pm UTC](https://community.bloomreach.com/t/pre-processing-of-document-events/2079/2 "2020-08-27T14:09:40Z")

</div>

> [@epineight](#):
>
> Is there a way to do that? And is it possible to also abort the delete operation?

There is one I can think of, relatively less hacky:

- The document workflow is controlled through the SCXML statemachine internally, and the scxml definition uses various atomic action tags such as version, copy\*, …, archiveDocument actions configured with their FCQNs in the repository. [1]
- Document deletion is done through the archiveDocument action `org.onehippo.repository.documentworkflow.action.ArchiveDocumentAction` in the end, which creates an real workhorse, `org.onehippo.repository.documentworkflow.task.ArchiveDocumentTask`.
- So, if the action class and task class are overriden with the FQCN configuration change in the repository, you can probably add any custom logic there, and if the task throws a WorkflowException, I think it will abort the operation, too.

Regards,

Woonsan

[1] [SCXML Workflow Engine - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS](https://documentation.bloomreach.com/14/library/concepts/workflow/scxml-workflow-engine.html)
