0

I am uploading an Alfresco file, I need get the file from documentLibrary dynamically, how can I do this? .bpm20.xml is possible.

 var dest= companyhome.childByNamePath("Sites/test/documentLibrary/"+${trainername});
     bpm_package.addNode(dest);

Please help out

Darren Shewry
  • 10,179
  • 4
  • 50
  • 46
Paul
  • 141
  • 1
  • 11
  • 1
    What do you mean "get the file from the document library"? What isn't working with the code you've written? – Gagravarr Oct 07 '16 at 11:58
  • now file we have mention statically, i have written Java class from the class i upload file to alfresco documentary library , i need same file name i need attach to workflow , i don't how get dynamically file name ,please help on this – Paul Oct 07 '16 at 12:16
  • Do you want to start the workflow while uploading the document into document library ? If so, you can rules, correct? – Muralidharan Deenathayalan Oct 08 '16 at 08:04
  • After created workflow i have to attach document – Paul Oct 12 '16 at 04:09

1 Answers1

2

The companyhome is one of root objects, class org.alfresco.repo.jscript.ScriptNode.

Method ScriptNode.childByNamePath(String path) returns another ScriptNode.

To get file name you can use ScriptNode.getName() method (Java or JavaScript) or name property (shortcut access to the cm:name property) in JavaScript.

var dest= companyhome.childByNamePath("Sites/test/documentLibrary/"+${trainername});
bpm_package.addNode(dest);
logger.info("and the file name is.... "+dest.name);

Is that answers your question?

BTW: "What's the difference between JavaScript and Java?"

Community
  • 1
  • 1
kinjelom
  • 6,105
  • 3
  • 35
  • 61