02-12-2024 11:51 AM
Hi, I am trying to unlock documents that are locked by an option: "Edit Offline" or "Edit Online". The given script executes in the javascript console in admin tools and it works only for documents edited online. When I want to execute it on a document that is blocked by offline editing, the following error occurs. I know that alfresco then creates a working copy of the document. Is there any way to unlock such a document?
// Get the node ID of the document var nodeId = "8a0451e0-2db0-4664-820c-3fad38375ab5"; // Try to find the document node var workNode = search.findNode("node", ["workspace", "SpacesStore", nodeId]); // Check if the node is found if (workNode != undefined) { // Perform operations on the document, e.g., unlocking 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(); logger.log("The document has been unlocked."); } else { logger.error("The document with the specified ID was not found or an error occurred."); }
Caused by: org.alfresco.service.cmr.lock.UnableToReleaseLockException: Unable to unlock node (id: 8a0451e0-2db0-4664-820c-3fad38375ab5) because it has been de-identified.
Explore our Alfresco products with the links below. Use labels to filter content by product module.