Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to get hold of eventType in workflow class?

Avatar

Avatar
Boost 3
Level 1
srig786
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 1
srig786
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
srig786
Level 1

05-03-2018

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 ?

  }

Replies

Avatar

Avatar
Give Back 5
Level 3
navinkaushal
Level 3

Likes

16 likes

Total Posts

70 posts

Correct Reply

7 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile

Avatar
Give Back 5
Level 3
navinkaushal
Level 3

Likes

16 likes

Total Posts

70 posts

Correct Reply

7 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile
navinkaushal
Level 3

05-03-2018

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

Avatar
Boost 3
Level 1
srig786
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 1
srig786
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
srig786
Level 1

06-03-2018

Thanks Navin. I would give it a try and get back to you.

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,089 likes

Total Posts

3,123 posts

Correct Reply

1,063 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,089 likes

Total Posts

3,123 posts

Correct Reply

1,063 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

06-03-2018

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