cancel
Showing results for 
Search instead for 
Did you mean: 

Records Management

Lino17
Champ in-the-making
Champ in-the-making

Hi 

I have written the following code to file a document as a record after a certain amount of time.It does not work, Can I ask how do I write code to file a document as a record.

here is the code:

var rootFolder = companyhome.childByNamePath("Sites/client-site/documentLibrary/Clients"); // Specify the path to the root folder.
var rmSite = siteService.getSite("rm");
//var recordFolder = rmSite.getContainer("Unfiled Records");
var logfile = companyhome.childByNamePath("Sites/client-site/documentLibrary/logfil.txt");


function declareAsRecord(node) {
  var timeElapsed = (new Date().getTime() - node.properties["cm:created"].getTime()) / (1000 * 60);

  if (node.isDocument && !node.hasAspect("rma:record") && timeElapsed >= 10) {

    var recordNode = rmSite.actionService.declareRecord(node);

  } else if (node.isContainer) {

    var children = node.children;
    for (var i = 0i < children.lengthi++) {
      declareAsRecord(children[i]);

    }
  }
}

declareAsRecord(rootFolder);
0 REPLIES 0