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.
Hi,
I'm trying to create a JavaScript file that destroy files when possible. However, I'm not finding a way to do that since, aparently, doesn't exist a document.destroy.
Is there some especific function that does this?
You may use Alfresco JSConsole addon:
https://community.venzia.es/alfresco-javascript-console/
This tools includes a full reference of Alfresco Repository JavaScript API.
Anyway, I guess you are looking for document.remove() method.
Thanks for the answer, but when I try to execute the method document.remove(), I get the following message:"09061538 Failed to execute script 'workspace://SpacesStore/58b89198-b52b-417c-a311-e9cc1c4f4fc3': Node does not exist: workspace://SpacesStore/60f67e94-6e73-42a2-8f3b-7eefc5e174f0 (statustatus[id=85115changeTxnId=0f6fd51b-248e-4cd8-b3d9-c1bcf4d43649, dbTxnId=13929, deleted=true])"Besides that, the addon just make things easier when it comes to test the script, anyway, I don't have the possibility of installing an addon such as the JSConsole, so this option is unviable.
Probably you're trying to remove the document in the same DB Transaction you are creating it.
That operation is not supported, since every JS script runs in a single DB Transaction.
My document was already created before the script and the only change I'm making is switch a option on the metadata to trigger the script.To exclusively test this, my code is only the method Document.remove(), I've already tried Document.parent.remove(), but both of them gives the same error.