Expand my Community achievements bar.

SOLVED

Get workflow id in page author mode

Avatar

Level 2

Hi ,

 

Is there any way to get workflow ID in edit mode of a page when logged in as a content author. Without servlet call to query the available workflows.

 

AEM version : 6.5

 

Thanks 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

you can use resource-status api to get running workflow for current page

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/restricting-a-page-to-be-s...

 

e.g. for content/AEM63App/fr

http://localhost:4502/resource-status/editor/content/AEM63App/fr.1.json 

 

If page is part of workflow it returns response something like below:

{"0":{"statusType":"workflow","statusPriority":10000,"shortMessage":"demo-email","variant":"info","i18n.message.snippets":["demo-email"],"title":"Workflow","message":"This page is subject to the workflow <i>{0}<\/i>"}}

 



Arun Patidar

View solution in original post

6 Replies

Avatar

Employee Advisor

Hi,

do I understand you correctly, that if a user opens a page in editmode and this is part of a workflow, you would like to retrieve the workflow ID of that workflow? What would you like to do with that ID?

Avatar

Level 2

Hi Jörg_Hoh,

 

Yes, I need the workflow id when a page is opened in edit mode and the page is subjected to a workflow. 

 I have a requirement where a content author should be able to terminate a workflow which he has triggered. So I want to add a button/link in the status bar which calls a servlet with workflow id as parameter.

Avatar

Level 2

Hi Jörg_Hoh,

 

I have tried with sending the page path as the parameter to the servlet and comparing it with each of the workflow data payload in available workflows by using the workflowsession.getAllWorkflows() method.

By this way I am able to get the workflows initiated by the current user and terminate the respective workflow if found. Even though the getAllWorkflows method returns the workflows initiated by the current user, I see there could be a performance issue with this method as it runs a query on all the available workflow instances. 

Looking for an alternate way, if AEM provides a way to get the workflow id.

Avatar

Community Advisor

Hi @tarunrajg ,

 

Hope this helps your requirement to get workflow id and enable it at the page level.

https://helpx.adobe.com/experience-manager/using/aem64_workflow_information.html

 

Regards,

Santosh

Avatar

Correct answer by
Community Advisor

you can use resource-status api to get running workflow for current page

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/restricting-a-page-to-be-s...

 

e.g. for content/AEM63App/fr

http://localhost:4502/resource-status/editor/content/AEM63App/fr.1.json 

 

If page is part of workflow it returns response something like below:

{"0":{"statusType":"workflow","statusPriority":10000,"shortMessage":"demo-email","variant":"info","i18n.message.snippets":["demo-email"],"title":"Workflow","message":"This page is subject to the workflow <i>{0}<\/i>"}}

 



Arun Patidar

Avatar

Level 2

Hi @arunpatidar ,

 

I have tried the resource-status and it does the job partly i.e., I am able to get the required values when logged in as admin or approver. 

But in case of content author session, the json does not contain the workflow id (Even for the workflow the user has triggered). It contains the workflow name and status.

I will try and test by modifying the user permissions and see which level/node has the access to retrieve the value.

Currently the author is in content-author group and has "read", "modify", "create", "delete" permissions for /var/workflow.

 

Thanks for your time and response as this solves a question that I raised in the forum.