Unable to unlock a page with system user using workflow in AEM 6.5

nandini559

16-07-2020

Hello,

Is there a way to unlock a page using workflow ?

Steps followed:

1) Content editor will lock the page manually.

2) Start the workflow and before ending the workflow, there is unlock process step to unlock the page.

3) Page unlock would be done by system user.

4) I see error at page.unlock() . The error is 

com.day.cq.wcm.api.WCMException: Unable to unlock page. msg:::Unable to unlock page

Tried giving permissions like jcr:lockmanagement, jcr:all to that specific page from crx but no use.

Please suggest a way to make this possible.

Answers (1)

Answers (1)

Nupur_Jain

MVP

16-07-2020

Hi @nandini559 

 

Please take reference from post https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/unlocking-a-page-with-syst.... This post had the similar issues as yours.

 

I went through the solutions and at the end it was concluded that "confirmed that a "system user" cannot unlock a page unless he owns the lock, no matter the permissions I give to him". At the end developer ended up chanding his flow to achive the same which is 

 

1- an AEM user initiates my custom workflow on a page

2- my WorkflowProcess implementation code, locks the page under the initiator session. This means that the initiator owns the lock of that page.

3- on a further down workflow step, my code needs to unlock the page, but the AEM user completing the step is not the same user as the one who owns the lock.

 

Therefore I have to manually (not programmatically) already have created a system user with permissions to unlock ANY page, AND have my code unlock the page under his session.

 

Go through the post and it should lead you to the solution. 

 

Hope it helps,

Nupur