cancel
Showing results for 
Search instead for 
Did you mean: 

Java backed Wscript calling JS script referenceError on args

jbaton
Champ in-the-making
Champ in-the-making
Hi,

My goal is to create a user and assign him to a group.

To do that, I did a java-backed webscript where the user is created. But, as I couldn't find the API to assign the user to a group, I thought I could call a JS script using this code

String group, user;

Map<String, Object> params= new HashMap();
params.put("groupe", group);
params.put("utilisateur", user);
Object retour = this.getServiceRegistry().getScriptService().executeScript("addusertogroup.js", params);


What is puzzling is the error message I get :

Failed to execute script 'addusertogroup.js': Failed to execute script 'addusertogroup.js': ReferenceError: "args" is undefined (AlfrescoScript#6)

Well, how can I access those parameters then.
I tried args.utilisateur and  args["utilisateur"] like in several webscripts examples without success.

I'm almost new to the javascript api and webscript.

Thanks

Jerome
1 REPLY 1

jbaton
Champ in-the-making
Champ in-the-making
Variables named after the keys of the map are usable in the jscript.

My script is fetched through the classpath, it seems to need a server restart to use the latest version of the JS
Although this is not true for the java class, as seen in debug mode.

I use JbossAS 405 launched in eclipse in debug mode, classes and JS copied (using ant) directly in alfresco/web-inf/classes.

Hope this wil help someone.



Jerome
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.