cancel
Showing results for 
Search instead for 
Did you mean: 

Root scope objects inside Javascript Debugger

acarpine
Champ in-the-making
Champ in-the-making
How can I use the root scope objects inside the Alfresco Javascript Debugger (available at http://[hostname]:[port]/share/page/api/javascript/debugger)?

http://wiki.alfresco.com/wiki/4.0_JavaScript_API#Scripting_API reports:
The Alfresco JavaScript API provides a rich set of scriptable Java objects that are available to the script writer. Many "root" scope objects (see below) are provided by default, such as access to the user home folder, company home folder, WCM Web Projects, search, People API…
but although I am able to use the root scope objects executing a script inside Alfresco, just using it direclty
groups.getGroup(groupName);
I can't figure out how to use/import that objects in a script tested with the Debugger.

tks
5 REPLIES 5

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
You don't need to import them, they're there by default for Alfresco, Alfresco adds those objects when the script gets executed

For the debugger you should be able to use it as well

acarpine
Champ in-the-making
Champ in-the-making
Executing a simple code like
groups.getAllRootGroups()
the debugger throws a popup with the exception
org.mozilla.javascript.EcmaError: ReferenceError: "groups" is not defined
and I obtain the same result with other root objects.

bengrah
Champ on-the-rise
Champ on-the-rise
Executing a simple code like
groups.getAllRootGroups()
the debugger throws a popup with the exception
org.mozilla.javascript.EcmaError: ReferenceError: "groups" is not defined
and I obtain the same result with other root objects.

There is no "groups" root scope object, you have to use the "people" root scope object which handles groups.

http://wiki.alfresco.com/wiki/4.0_JavaScript_API#People_API

Thanks,
ben

acarpine
Champ in-the-making
Champ in-the-making
The section "Root Scope Objects" of http://wiki.alfresco.com/wiki/4.0_JavaScript_API#Scripting_API reports
groups    The root of group authorities. Providing access to groups Groups
and when I use that object from a script inside Alfresco all works well.
Anyway trying to use people I obtain the same Exception
org.mozilla.javascript.EcmaError: ReferenceError: "people" is not defined

acarpine
Champ in-the-making
Champ in-the-making
I hoped to test Javacript using the debugger option to load an external javascript file and see the result directly in the debug before to load it in Alfresco but I understand now that this is out of the scope of the debugger.

tks anyway