Expand my Community achievements bar.

How to get hold of eventType in workflow class?

Avatar

Level 2

Hi,

I am Sri. I have created two workflow events (Node created and Node modified) using workflow launcher. I would like to know which event got triggered ?. Do we have a method to read eventType using arguments available in the execute method or please let me know if there is another way to get hold of event type ?

  @Override

  public void execute(WorkItem arg0, WorkflowSession arg1, MetaDataMap arg2)

  throws WorkflowException {

          //how to get hold of event type that is triggered ?

  }

3 Replies

Avatar

Level 4

Hi srig786,

The event you are talking about is not a part of Workflows. Its part of Node and JCR Event Observation Class. What you may need to do is:

1. Create a JCR Event Observer/Handler Service (example is here Creating an AEM JCR Event Listener using a Maven Archetype 12 Project )

2. Add both the observations in that service.

3. Use that service to observe while executing your workflow model.

Hope this helps!

Regards,

Navin

Avatar

Employee Advisor

In the workflow itself it is not immediately obvious why it has been triggered (by which condition of the workflow launcher). But that shouldn't matter at all. If you need to know that it would be the easiest if you trigger a different workflow; and then of course you can reuse workflow steps, so the overhead of this is quite low.

Jörg