-2

I'm using Alfresco Community 5.2 edition. I have folder called 'commission_paper_received' and it has 12 sub folders which every folder having a specific date as the folder name (ex: 02-05-2018). When a document entered into the 'commission_paper_received' folder, I need to move it to the relevant folder which has the same month of the created date as the folder name. Ex:- Assume a document entered to the 'commission_paper_received' folder which having 14-03-2018 as the created date. And, 'commission_paper_received' folder has 3 sub folders which having folder names 20-03-1018, 10-04-2018, 23-05-2018. I need to move that document into the folder named 20-03-1018.

Can anyone help me to achieve this. I need to know how to find the correct folder according to the month.

  • This question is out of scope. Let others do your homework is not subject of this platform. See https://stackoverflow.com/help/on-topic and https://stackoverflow.com/help/how-to-ask – Heiko Robert Mar 13 '18 at 07:47

1 Answers1

1

You can create rule on folder and check when you wanted to call your rule.

Execute your script code to check the month folder and move folder in it.

execute your script code by checking that your document is folder

 document.isFolder();

If this return true than execute your script and check your month folder and move it into

 document.move(monthFolderNode);

Refer this documentation to create rule and question

Vikash Patel
  • 1,328
  • 9
  • 28
  • But it does not having folder which has exact same name. For an example, to this month it having a folder named 15-03-2018. But the document created date is 05-03-2018. I need to move the document without considering the date. Actually, i need to select the suitable folder using only month and year. –  Mar 12 '18 at 09:54
  • Ok means,05-03-2018 this folder should be moved to this 15-03-2018 folder? – Vikash Patel Mar 12 '18 at 09:59
  • and this 15-03-2018 folder will be current month folder always? – Vikash Patel Mar 12 '18 at 10:01
  • I have created something like, var createdDate = document.properties["cm:created"]; var dd = createdDate.getDate(); var mm = createdDate.getMonth()+1; //January is 0! var yyyy = createdDate.getFullYear(); if(dd<10){ dd='0'+dd; } if(mm<10){ mm='0'+mm; } var today = dd + "-" + mm + "-" + yyyy; var objDestFolder = companyhome.childByNamePath("Shared/SECRETARY/COMMISSION_MEETINGS/" + today); document.copy(objDestFolder); But this is not working because there is no folder which has the full date of today. I need to get it LIKE -mm-yyyy without dd. –  Mar 12 '18 at 10:10
  • Ok,Then get the current date and your folder date and check if both month are mached then execute your code. – Vikash Patel Mar 12 '18 at 11:54