Get all the workflows triggered for a payload (asset path) | Community
Skip to main content
Level 2
Nov 22, 2017 11:45 AM UTC
Solved

Get all the workflows triggered for a payload (asset path)

Hello,

Is there any way to get all the workflow instances launched for a payload (e.g. /content/dam/assets/weddingPictures/party1.jpg).

The two only methods that I can guess are:

Regards.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
manoj_devapath
manoj_devapathAccepted solution
Level 5
Nov 22, 2017 5:46 PM UTC

OK got you.

For getting those result OOB provides a servlet path with some basic parameters like (start,limit)

http://localhost:4502/libs/cq/workflow/content/console/archive.json?_dc=1511371717582&start=0&limit=40

each result object

{

item: "/etc/workflow/instances/server0/2017-11-22/update_asset_3",

state: "COMPLETED",

initiator: "*",

launcherUser: "admin",

startTime: 1511366004403,

endTime: 1511366004826,

model: "DAM Update Asset",

modelVersion: "1.1",

payload: "/content/dam/*/*/*/jcr:content/renditions/original",

comment: "",

title: ""

}

if you want you can overlay this functionality or create a new servlet with your custom script according to your use case

To start on pls take a lookt at

/libs/cq/workflow/content/console/archive

and code in /libs/cq/workflow/components/console/archive/json.jsp

json.jsp has already some working apis in it

Hope this helps

~Manoj

5 replies

Alvaro_C_Author
Level 2
Nov 22, 2017 6:52 PM UTC

Many thanks!

That's the pointer I was looking for.

Regards.

Translate
manoj_devapath
manoj_devapathAccepted solution
Level 5
Nov 22, 2017 5:46 PM UTC

OK got you.

For getting those result OOB provides a servlet path with some basic parameters like (start,limit)

http://localhost:4502/libs/cq/workflow/content/console/archive.json?_dc=1511371717582&start=0&limit=40

each result object

{

item: "/etc/workflow/instances/server0/2017-11-22/update_asset_3",

state: "COMPLETED",

initiator: "*",

launcherUser: "admin",

startTime: 1511366004403,

endTime: 1511366004826,

model: "DAM Update Asset",

modelVersion: "1.1",

payload: "/content/dam/*/*/*/jcr:content/renditions/original",

comment: "",

title: ""

}

if you want you can overlay this functionality or create a new servlet with your custom script according to your use case

To start on pls take a lookt at

/libs/cq/workflow/content/console/archive

and code in /libs/cq/workflow/components/console/archive/json.jsp

json.jsp has already some working apis in it

Hope this helps

~Manoj

Translate
Alvaro_C_Author
Level 2
Nov 22, 2017 4:45 PM UTC

Hello,

This discussion is more related to stats on workflows. Actually I'm not interested on the ones that are currently running but on the past activity. The kind of queries I would like to answer are:

  • Which are the content path with more workflow activity during the last month?
  • Which workflows were triggered under path X between January and April?
  • Which are the most widely used workflows?
  • etc.

On the other hand, just comment that in our production environment every asset can be modified dozens of times by different workflows during its life-cycle.

Regards.

Translate
manoj_devapath
Level 5
Nov 22, 2017 4:14 PM UTC

Yes we invoke workflow for an asset and In that thread we can get All WorkItems assigned to an active Workflow instance and the respective user of the WorkflowSession .

WorkItem[] workItems = wfSession.getActiveWorkItems();

Translate
smacdonald2008
Level 10
Nov 22, 2017 4:01 PM UTC

Typically you invoke a workflow for a specific asset.

Translate