Expand my Community achievements bar.

AEM 6.4.1.0 - Workflow history in page properties [display info in custom tab]

Avatar

Level 8

Hi All,

1] In OOTB AEM, http://localhost:4502/libs/cq/workflow/admin/console/content/instances.html it displays list of running workflow instances and on selecting any one particular entry and clicking on "Open History", it shows up the "Workflow Instance History" tab with the details.

2] We want this similar feature to be implemented in the page properties i.e, wherein if I click on "Page-> Open Properties"[for example : http://localhost:4502/mnt/overlay/wcm/core/content/sites/properties.html?item=/content/we-retail/us/... ]. we should have a new tab say "history" and we should be able to see the workflow history for that concerned page.

Any thoughts/pointers/reference on how do we go about this will be really really helpful.

8 Replies

Avatar

Level 10

Wouldn't 'Timeline' feature suffice for this requirement? Within 'Timeline' you could choose 'workflow' or 'show all' based on your use case.

1712471_pastedImage_1.png

Avatar

Level 8

Hi Gaurav,

They want a similar thing as it comes up when the below is done, for the concerned page :

http://localhost:4502/libs/cq/workflow/admin/console/content/instances.html

it displays list of running workflow instances and on selecting any one particular entry and clicking on "Open History", it shows up the "Workflow Instance History" tab with the details.

Avatar

Level 10

Well, in that case, debug OOB code for the link you mentioned and find if you can utilize the same with a page path being passed to it dynamically.

Avatar

Level 8

Hi Gaurav,

Thank you for your reply. Will check on this.

If we have a page and we need to know what is the most recent workflow instance associated with that page[suppose there are 2 different workflows it is associated with].

1] How do we find that out. Tried couple of things, but no luck. Any pointers/reference code will be helpful.

2] Also, was just checking on feasibility of another option.

Suppose we have any workflow running on a page and if we hit the below url, it gets us all of the wf history data in a json format.

Can this be leveraged to meet our requirement.

http://localhost:4502/libs/cq/workflow/content/console/history.json?workflow=/var/workflow/instances...

Any pointers/reference code will be really helpful.

Avatar

Level 10

It still doesn't make sense to me. Couple of pointers if you wish to proceed:

OOB code for http://localhost:4502/libs/cq/workflow/admin/console/content/instances.html​ is under  "/libs/cq/workflow/admin/console/components"

For extending page properties check

Editing Page Properties

Extending Page Properties in AEM Sites

For history.json refer "/libs/cq/workflow/components/workitem/json.jsp" and other related components "/libs/cq/workflow/components"

Avatar

Level 8

Hi Gaurav,

Not planning to overlay the workflow components rendering the json[ as it will affect at other places], but was wondering if we can hit that json url for the concerned page. That way probably we will get all the required data for display, which thereon needs to be displayed in the custom tab.

Like, suppose if on page 'x', a workflow is running, then I need to find the instance id [i.e, /var/workflow/instances/server0/2019-03-15/custom-workflow_1] and then append that to the url http://localhost:4502/libs/cq/workflow/content/console/history.json?workflow=  and form an entire url http://localhost:4502/libs/cq/workflow/content/console/history.json?workflow=/var/workflow/instances...

Please let us know your thoughts on this.

Avatar

Level 8

Hi All,

With the above mentioned approach, we are able to get the json. However, we need credentials to be passed to httpclient call and want to avoid this approach.

Pointed the dialog tab[i.e, resourceType] to a jsp[the content of which is taken from /libs/cq/workflow/components/console/history/json.jsp].

Via this in the browser console[F12 key], able to see the json response.

1] But not getting how to render this data.

Any pointers/reference code will be really helpful.

Avatar

Level 10

For this - I recommend contacting Adobe Consulting. This is not a documented use case or available OOTB.