As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
I am trying to unlock node using cancel editing but due to some error, it is not getting unlock.
I am not able to perform any type of operation on that node.
How Can I forcefully unlock?
If you know how to create javascript webscript, you can inspire from this one:
var nodeId = url.templateArgs.id; var workNode = null; var workNodeStatus = null; model.msg = ""; model.nodeId = nodeId; workNode = search.findNode("node", ["workspace", "SpacesStore", nodeId]); if (workNode != undefined) { workNodeStatus = workNode.hasAspect("cm:lockable"); } if (workNode == undefined) { status.code = 404; status.message = "Object " + nodeId + " not found."; status.redirect = true; } if (workNode != undefined && workNodeStatus == true) { workNode.properties["cm:lockOwner"]="admin"; workNode.unlock(); workNode.properties["cm:lockOwner"]="admin"; workNode.removeAspect("cm:lockable"); workNode.save(); delete workNode.properties["webdav:opaquelocktoken"]; delete workNode.properties["webdav:lockScope"]; delete workNode.properties["webdav:lockDepth"]; workNode.save(); model.msg = "is unlocked"; } else if (workNode != undefined && workNodeStatus == false) { model.msg = "is not locked"; } else { status.code = 500; status.message = "Sorry, something went wrong. See log file."; status.redirect = true; }
<webscript> <shortname>Unlock document</shortname> <description>Unlock document</description> <url>/AdminTools/unlock/{id}</url> <format default="xml">argument</format> <authentication>user</authentication> <transaction>required</transaction> <cache> <never>true</never> </cache> </webscript>
<?xml version="1.0" encoding="UTF-8"?> <node> <id>${nodeId?xml}</id> <updated>${xmldate(date)}</updated> <message>${msg}</message> </node>
See if this is helpful, i had a similar issue so i documented the details here:
https://javaworld-abhinav.blogspot.com/2020/06/unlock-node-in-alfresco-which-could-not.html