AnsweredAssumed Answered

Deleting Node using onUpdateProperties behavior is failing

Question asked by dswenson on Aug 25, 2014
Latest reply on Aug 27, 2014 by mrogers
We have a custom status property that stores the current publishing status of an asset (Draft, published, in review, etc). When the status is set to "Expired" by our doclib action (by calling nodeService.setProperty), our onUpdateProperties behavior fires. The behavior determines that the status is now "Expired" and therefore will delete the node from the repository (nodeService.deleteNode).

Here is the issue: It appears that the setProperty function does not fully complete. Once the function is called, the behavior is triggered. Since the node is deleted in the behavior, the setProperty function cannot complete its execution (can't set property on a node that does not exist). This is confirmed by the "Node does not exist" errors that appear in our stacktrace. Since setProperty can not finish its execution, our changes are rolled back; the status is not updated and the node is not deleted. 

My question is, can this method be used to delete a node (update property on a node, have onUpdateProperties behavior delete current node)? We are using this method now since we need to automate this process as well (example: once the date is passed a documents effective publishing date, we set the status to "Expired")