Issue with javscript that removes another node when a node is deleted.
function main() {
var parent = space.parent;
var parentOfParent = parent.parent;
var staffnetFolder = companyhome.childByNamePath("Shared/Staffnet/" + parentOfParent.name + "/" + parent.name);
var pdf = staffnetFolder.childByNamePath(document.name + ".pdf");
if (pdf !== null) { pdf.remove(); }
}
main();
Basically, when an item is created we have a rule to create a pdf of it in another space. When the item is deleted, I want to delete the pdf as well. It's finding the PDF successfully, but when I run the remove() on the pdf I get this error -
"message" : "JavaException: org.springframework.dao.ConcurrencyFailureException: Deleted 0 but expected 1"