AnsweredAssumed Answered

Accessing parent folder of a document in workflow script

Question asked by ssdev on Apr 9, 2014
Latest reply on Apr 9, 2014 by ssdev

I have a custom workflow in which I run the following script

<activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
    <activiti:field name="script">
            var document = bpm_package.children[0];

            var siteName = document.siteShortName;
       var folderPath = "Sites/" + siteName + "/documentLibrary/Completed";
       var folder = companyhome.childByNamePath(folderPath);


Currently I am using the command 'document.move(folder)' to move the document linked to the workflow. However I would like to move the whole parent folder that the document is in. Is there are commend that I can use to access the document's parent folder from here?

I have tried but this returned null? Has anybody had the same issue or have an idea of a command which can retrieve the parent node of document?