AnsweredAssumed Answered

[SOLVED]Dynamically creating Rules for folders in JavaScript

Question asked by smcardle on Jan 4, 2013
Latest reply on Jan 7, 2013 by smcardle
Hi All.

We currently have a few JavaScript WebScript controllers that use a utility JavaScript script to create folder heirachies using a template loaded from the repository. This utility scrip also does token replacement so the names of folders and subfolders can be defined and replaced at runtime.

What I would now like to do is dynamically associate Rules to some of these folders during construction of the heirachy. There are a few REST webscripts for Rules in the repository but its not that easy to call these from a Repository based WebScript. Obviously with Share and other Surf apps it's possible via the remote API, which is not available to the Repository webscripts.

I did read an article where Jeff Potts indicated that the remote object was available but disabled by default for respository based webscripts but he couldn't remember how to enable it. There are also other resources on Stack Overflow refering to an article explaining how to do this, but unfortuanley that link no longer works.

I also do not want to have to include other Java libraries into our projects such as HttpClient then expose this to the script engine using Spring as this makes the deployment of these scripts much more difficult to deploy as a jar or zip file (really not a big fan of AMP deployments). I also do not want to use the Java Rules API as it's far to complicated for the average javascript script developer to use.

What I would like is a clear description of how to expose the remote object to repository based javascript webscript controllers and use that to call the Rule REST scripts and define the rules using easy to construct, understood by all, json objects.

Any help here would be great and if anybody is interested in the scripts and template structure I wrote to automatically construct folder heirachies I would be more than willing to share :)

Regards

Steve

Outcomes