cancel
Showing results for 
Search instead for 
Did you mean: 

using CategoryService from webscript

orha
Champ in-the-making
Champ in-the-making
Hi again.
Sorry to bother you twice a day, but I have one more question I couldn't find the answer to: I want to use categoryService API to add a new category from my webscript. I tried using:

function addCategory(newCat) {
   var tags = search.luceneSearch("PATH:\"/cm:generalclassifiable//cm:Tags\"")[0];
   var newCategory = categoryService.createCategory(tags, newCat);
   return newCategory;
}
Where Tags is the category under which I want to create the new category, and newCat is a string with the name of the new category.
When I run it, I get an error saying that categoryService is not defined.
Is there a way to use cateogryService? Is there anything else I should try?

Thank you!
Or
2 REPLIES 2

lista
Star Contributor
Star Contributor
Hi,

you can't use that right out-of-the-box.
Have you looked at the JavaScript Classification API, does that solve your problems?
http://wiki.alfresco.com/wiki/3.0_JavaScript_API#Classification_API

If it does not help you, then you first need to make categoryService available to your web script.
http://wiki.alfresco.com/wiki/Configuring_the_ServiceRegistry_as_a_Javascript_Root_Object

Cheers,
Lista.

orha
Champ in-the-making
Champ in-the-making
Thank you!
I did what I needed with the javascript API, and it worked magnificently.

Or