AnsweredAssumed Answered

JavaScript API Error on rule/action

Question asked by on May 10, 2013
Latest reply on May 17, 2013 by
I'm try to write a script for create a new subfolder when email is send to an alfresco folder (associted to an alias) via SMTP.
I need to create this subfolder under the folder that is performing the rule;therefore, the new folder should be named as the Subject field of the email arrived.
The script is associated to the folder via rule, and i try to execute it in backgroud and not. The rule i applied only to document that have the "emailed" Aspect.

I cannot use the debugger, because an issue of alfresco 4.2d edition. But i had try debugging code omitting some line and the error is in the["cm:subjectline"] - function. If i set it with static string the folder is created.

This is the code/flow:

/* The mail new mail arrive to folder with alias */

var id =;
var name =;
var type = companyhome.type;
var noderef = companyhome.nodeRef;
var childList = companyhome.children;
var properties =;
var assocs = companyhome.assocs;

/*I change doccument mimetype for correct  preview and save it */

/*Add a new folder naming it with the same name as email subject */
var newRNCFolder = space.childByNamePath(["cm:subjectline"]);
if (newRNCFolder == null && space.hasPermission("CreateChildren"))
   // create the folder for the first time
   newRNCFolder = space.createFolder(["cm:subjectline"]);