cancel
Showing results for 
Search instead for 
Did you mean: 

Access space node from JavaScript if rules are applied

redomancer
Champ in-the-making
Champ in-the-making
The situation:
1) I have to execute some JavaScript script for space if some criteria are met, for example, if space aspect data are filled; thos must be done also for all sub spaces; to achieve that, a rule has been created for top level space with option "rule applies to subfolders" which executes script;
2) the proble - from sript its impossible to access the current space!!

If we check documentation http://wiki.alfresco.com/wiki/4.0_JavaScript_API, there said:

space - The current space Script Node (if any). Note that for a script executing from a rule, the space object will be the space that the rule resides in, this may not be the space you are expecting if the rule is inherited.

So how can I access the current space node, not top one on which rule was applied? In documentation I cant see any of objects which could help. Is there a solution for this problem?
1 REPLY 1

openpj
Elite Collaborator
Elite Collaborator
You have to use the SearchService of Alfresco that is available in the Javascript API using the Search API.