I have requirement for creating folder structure periodically using scheduler. Scheduler configrued to execute a script , script will create document in specific folder , My root folder shown below image . I need to create a folder '2020' under 'claim' folder using Alfresco Javascript API.
Question is : -
1- How do i navigate to 'claim' using javascript API. I have tried following script
var envSubFolder = companyhome.childByNamePath("CLAIM");
var claimPath = envSubFolder.displayPath
'claimPath' always return 'PATH/Company Home'
How will i navigate to 'Document/Buisness Documents/Claim' and create a child folder under 'Claim' folder ? Any blog or link is highly apprecirated .
My folder structure shows below.
When you use "companyhome", you are actually using a root object, described here. If you take a look, you'll see that it's type is "org.alfresco.repo.jscript.ScriptNode".
https://docs.alfresco.com/6.1/references/API-JS-rootscoped.html
If you now look at the "childByNamePath" method, you'll see that path is used to find your child. So your code actually tries to find "CLAIM" immediately under the Company Home, and that node really does not exists (since it's under the "Business Document" folder).
https://docs.alfresco.com/6.1/references/API-JS-childbyNamePath.html