AnsweredAssumed Answered

Howto Remove Entries from a Map in Rhino JavaScript

Question asked by stevewickii on Aug 27, 2008
Latest reply on Dec 1, 2008 by mruflin
I am trying to remove a property from a node using the JavaScript API.  It should be possible.  I use the search.luceneSearch("query…") to get a list of ScriptNode objects.  Each ScriptNode has a "properties" member of type ScriptableQNameMap, and ScriptableQNameMap has a delete(String name) and remove(String name) method which both are defined to remove a property from the Map.

My problem is that I keep getting this error when I execute 'Delete Property.js': "EvaluatorException: missing name after . operator"

URL:  http:// localhost:9080/alfresco/command/script/execute?scriptPath=/Company%20Home/Data%20Dictionary/Scripts/Delete%20Property.js&property=fs:searchMeta

Delete Property.js
function main()
    return "Missing required request parameter: property";

  var nodes = search.luceneSearch("TYPE:\"{}downloadable\"");
  var propertyName =;

  var str = "Deleted Property '"+ propertyName+" from the following Nodes:<hr>\r\n";

  for each (var node in nodes)
  {;; // This method uses NodeService.setProperties(), which should remove any properties from the Node that are not in the map.
    str +="<br>\r\n";
  return str;


Any help would be much appreciated.