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
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.