how to adres the behaviour variable in a alfresco javascript

I`m making some “On-Create-Folder” behaviour.

– To make things simple i created a “behaviour action” button (aka a custom action) which calls a javascript which I stored in the datadictionairy / scripts folder. This script is stored inside the Alfresco repository. It’s called aaa_onCreateNode.js and  does only this :

logger.log(” GOTCHA from ALFRESCO repository”);

This script is triggered manually by pressing the button.

– I have another script which is located outside the repository & stored on this location: alfresco/extension/scripts/behaviours/aaa_onCreateNode.js
This is running from the classpath

<bean id=”onCreateNode” class=”org.alfresco.repo.policy.registration.ClassPolicyRegistration” parent=”policyRegistration”>
<property name=”policyName”>
<property name=”className”>
<property name=”behaviour”>
<bean class=”org.alfresco.repo.jscript.ScriptBehaviour” parent=”scriptBehaviour”>
<property name=”location”>
<bean class=”org.alfresco.repo.jscript.ClasspathScriptLocation”>

This script is called automatically when I create a new space.

So now I have both scripts up & running, I need to access some environment parameters. I want to know for example from which location I am working from.

The parameter behaviour works for the script which is automatically started (aka the script run from the classpath) So this gives me all the handles I need to do stuff.

if ( != null && == “onCreateNode”){
var childAssoc = behaviour.args[0];
var node = childAssoc.getChild();
var companyhome = search.findNode(“path”, [‘workspace’,’SpacesStore’,’app:company_home’]);





Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen. logo

Je reageert onder je account. Log uit /  Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit /  Bijwerken )


Je reageert onder je Twitter account. Log uit /  Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit /  Bijwerken )


Verbinden met %s