AnsweredAssumed Answered

Get properties of a node

Question asked by sihnu on Apr 29, 2011
Latest reply on Apr 29, 2011 by sihnu
Hi, I stumbled on a weird problem recently. I use lucene search to search for all the nodes that have aspect Complianceable. I can find the nodes I'm looking for but for some reason all values of the properties I can get from those nodes are their names. Like here:

var isCompAdded = "ASPECT:\"{http://www.alfresco.org/model/content/1.0}complianceable\"";

var searchQuery = isCompAdded;

var results = search.luceneSearch(searchQuery);

for(var i=0; i<=results.length; i++)
{
if(results[i] != null)
{
log += "File Name:" + results[i].properties.name + "\n";
}
}

But if I try to refer to any other property that node has I get the following error:

org.alfresco.scripts.ScriptException: 03290000 Failed to execute script 'workspace://SpacesStore/6b12ff23-fc8e-451e-b860-17e14f723a1a': Node does not exist: workspace://SpacesStore/45560937-a9a9-496d-a04a-ba3cf674260f

For example if I try to get a value of property removeAfter like here:

for(var i=0; i<=results.length; i++)
{
if(results[i] != null)
var removeDate = results[i].removeAfter;
{
log += "File Name:" + results[i].properties.name + "remove date:  " + removeDate + "\n";
}
}

I've tried all:

results.removeAfter;
results.properties["cm:removeAfter"];
results.properties.removeAfter;


But they all give the same error. I've checked from the log that names of the nodes are correct ones and those nodes have also a property removeAfter. I've also  tried other properties like cm:created but that gives the same error. How shoudl I refer to the property of the node so I could get the value?

Any help would be appreciated  :)

Outcomes