0

I am working on a custom doclib javascript. I have a folder structure which is similar to A --> B --> C where A and B have multiple children. I have the noderef of the folder A which I have found out through

"this.doclistMetadata.parent.nodeRef"

What is the easiest way to get the uri from the Node "C" while staying at Node A level? Can file path be used for this purpose?

BlueStar
  • 401
  • 3
  • 9
  • 29

2 Answers2

2

You should get ScriptNode object (ScriptNode class):

var A = this.doclistMetadata.parent;
// or by nodeRef
// var A =  search.findNode("workspace://SpacesStore/abcdefg-your-A-folder-id");

and use ScriptNode API

var C = A.childByNamePath("B/C");
print(C.name+" nodeRef: "+C.nodeRef.toString());
print(C.name+" children: "+C.childFileFolders());

It works for any ScriptNode object, virtual/smart folders too.

kinjelom
  • 6,105
  • 3
  • 35
  • 61
0

I think that you can use this:

For example, in the workflows, you can search for an element with the id "page_x002e_data-form_x002e_task-edit_x0023_default_assoc_packageItems". If there is more than one document associated, the value will be a comma separated list of noderefs.

var nodeRef = YAHOO.util.Selector.query("#page_x002e_data-form_x002e_task-edit_x0023_default_assoc_packageItems")[0].value;

Using the browser debug tool, you can inspect the html. As you can see in the image attached below, Alfresco stores the documents attached to the task in an hidden input. You could use YAHOO to get it.

enter image description here

(Source: https://stackoverflow.com/a/35257692/4337310)

Community
  • 1
  • 1
PRVS
  • 1,612
  • 4
  • 38
  • 75