cancel
Showing results for 
Search instead for 
Did you mean: 

category.addSubCategory

gcoleman
Champ in-the-making
Champ in-the-making
Does any one know why this javascript does not work in Alfresco 2.1

16:34:15,074 DEBUG [repo.jscript.RhinoScriptProcessor] Script content resolved t
o:
var cat = search.luceneSearch("PATH:\"cm:generalclassifiable//cm:Keywords\" ")[0
];

logger.log("cat");
logger.log(cat);
logger.log("cat.isCategory");
logger.log(cat.isCategory);
logger.log("cat.name");
logger.log(cat.name);
logger.log("createSubCategory");
cat.createSubCategory("greg");

16:34:15,152 DEBUG [repo.jscript.ScriptLogger] cat
16:34:15,152 DEBUG [repo.jscript.ScriptLogger] Node Type: {http://www.alfresco.o
rg/model/content/1.0}category, Node Aspects: [{http://www.alfresco.org/model/con
tent/1.0}auditable, {http://www.alfresco.org/model/content/1.0}titled, {http://w
ww.alfresco.org/model/system/1.0}referenceable]
16:34:15,152 DEBUG [repo.jscript.ScriptLogger] cat.isCategory
16:34:15,152 DEBUG [repo.jscript.ScriptLogger] false
16:34:15,152 DEBUG [repo.jscript.ScriptLogger] cat.name
16:34:15,168 DEBUG [repo.jscript.ScriptLogger] Keywords
16:34:15,168 DEBUG [repo.jscript.ScriptLogger] createSubCategory
16:34:15,168 DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 9
4ms
16:34:15,168 ERROR [ui.common.Utils] Failed to run Actions due to error: Failed
to execute script 'workspace://SpacesStore/6fd4fc54-7568-11dc-95d4-b5c864bcc81a'
: Failed to execute script 'workspace://SpacesStore/6fd4fc54-7568-11dc-95d4-b5c8
64bcc81a': TypeError: Cannot find function createSubCategory. (AlfrescoScript#10
)
4 REPLIES 4

kevinr
Star Contributor
Star Contributor
That looks like a bug - nodes returned from Search are not correctly coerced into Category node object types. I have raised an issue for this:
http://issues.alfresco.com/browse/AR-1811

Thanks,

Kevin

kbonnet
Champ in-the-making
Champ in-the-making
Damn.. i'm now running into this same problem. Any ideas on the timeline for solving this? Or maybe a workaround?

kbonnet
Champ in-the-making
Champ in-the-making
There is a clean workaround, for as far as i can judge:

 createNode("Category Name","cm:category","","cm:subcategories");

Koen

amarendra_thaku
Champ in-the-making
Champ in-the-making
Dear All,

Event if do
cNode[0].subCategories();

here my cNode[0] is of type "cm:category"

i am getting the same error that function subCategories() not found.

Any idea what could be the other workaround for the same

Thanks & Regards
Amarendra Thakur
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.