AnsweredAssumed Answered

filing records via Web Scripts / JavaScript API

Question asked by kgeis on Dec 19, 2009
Latest reply on Dec 24, 2009 by fpp
I'm having problems writing a web script that can put some content into a RM folder.  I am basing my script on the example upload script.  Here's a snippet from my script:

  // find the appropriate record folder
  var filePlan = companyhome.childByNamePath("Sites/rm/documentlibrary");
  var recordFolder = filePlan.childByNamePath("Civilian Files/Case Files and Papers/Gilbert Competency Hearing");

  // create document in the record folder for uploaded file
  record = recordFolder.createFile(filename);; = "UTF-8"; = title; = description;;
Now, when I create a file in the record folder, RecordsManagementServiceImpl.onFileContent(..) is called by policy and the record aspects are added.  This is good.  However, when I go to view the created record in the node browser, the title and description are null.  I can't figure out how to set those in my script.

When I go to share and try to view the document, it bombs on the metadata form.  I guessed that some expected metadata was missing, and I found that the Share filed records have the "author" and "versionable" aspects in addition to what mine had.  So, I went to add the versionable aspect to my document by saying

The effect of this is putting Alfresco into an infinite loop somewhere deep in its bowels.  If I'm "lucky" enough to use a database that does table locking, it just bombs after a timeout period.  (H2 bombs, H2 with MVCC enabled loops, PostgreSQL loops.)

I figured that I need to add the metadata in as similar a way to Share as possible, but I'm having a lot of trouble wrapping my head around the complexities of the implementation.

If Alfresco engineering reads this, please expose RM actions via the ScriptRecordsManagmentService.

Help would be appreciated.