Hello guys ,
How can we unlock a page automatically just after its workflow is terminated manually ?
thanks ,
Rahul Kumar
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Both,
There is already OOTB Lock/Unlock Steps available, you can use that in order to lock page
Workflow Steps:
1. Workflow Initaite
2. Approval Step
3. Lock
4. Activate/Deactivate
5. Unlock
Are you using any custom workflow?
Generally to lock or unlock a page through code-
// To Lock a page
PageManager pageManager = resourceResolver.adaptTo(PageManager.class);
Page page = pageManager.getPage("/content/myPage");
pageManager.lock(page);
// To Unlock a page
pageManager.unlock(page);
If you are using a custom workflow - you have to add workflow step:
@Override
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) throws WorkflowException {
try {
ResourceResolver resourceResolver = workflowSession.adaptTo(ResourceResolver.class);
PageManager pageManager = resourceResolver.adaptTo(PageManager.class);
String path = workItem.getWorkflowData().getPayload().toString();
Page page = pageManager.getPage(path);
if (page != null && pageManager.isLocked(page)) {
pageManager.unlock(page);
}
} catch (Exception e) {
throw new WorkflowException("Failed to unlock page", e);
}
}
Hi Both,
There is already OOTB Lock/Unlock Steps available, you can use that in order to lock page
Workflow Steps:
1. Workflow Initaite
2. Approval Step
3. Lock
4. Activate/Deactivate
5. Unlock
Hi @SureshDhulipudi , thank you for reply . We are using custom workflow and we have already incorporated code to lock and unlock pages in our code and its working fine .
And we have also one workflow (Unlock a page ) available but we have to do it manually for each page and in our case only admins and developers can use this workflow . Content authors are not able to see this workflow .
Is there a way to unlock a page automatically just after workflow is terminated for the same page from tools -> workflow -> instances -> select the workflow which needs to be terminated -> TERMINATE option (top-left most option ) ?
@RahulKu8 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies