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

SOLVED

Get workflow id in page author mode

tarunrajg
Level 2
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 

AEM 6.5 AEM 6.5 workflows Workflow instance
1 Accepted Solution
Arun_Patidar
Correct answer by
Community Advisor
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>"}}

 

View solution in original post

6 Replies
Jörg_Hoh
Employee
Employee

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?

tarunrajg
Level 2
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.

tarunrajg
Level 2
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.

santhosh_kumark
Community Advisor
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

Arun_Patidar
Correct answer by
Community Advisor
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>"}}

 

View solution in original post

tarunrajg
Level 2
Level 2

Hi @Arun_Patidar ,

 

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.