AnsweredAssumed Answered

JavaScript for showing/manipulating rules

Question asked by lercherl on Apr 22, 2016
Latest reply on Apr 27, 2016 by lercherl
I want to automate a few checks concerning rules (e.g. check whether rules are disabled, apply to subfolders etc.). It seems there is no JavaScript API for showing/manipulating rules. Starting from hints found in this discussion:
https://forums.alfresco.com/forum/developer-discussions/other-apis/there-way-delete-content-rules-using-javascript-api-10172013
I could do most of what I need to do using the general node API. Starting from the rule folder and recursively traversing its children I can find all the rules, its conditions, actions and parameters.

But there is one exception: If a rule executes a script I cannot get the UUID or some other unique identifier of the script. Here's an example: I list all of the nodes' properties and find one like this:


{http://www.alfresco.org/model/system/1.0}node-dbid: 239416
{http://www.alfresco.org/model/action/1.0}parameterName: script-ref
{http://www.alfresco.org/model/action/1.0}parameterValue: Node Type: {http://www.alfresco.org/model/content/1.0}content, Node Aspects: [{http://www.alfresco.org/model/content/1.0}indexControl, {http://www.alfresco.org/model/content/1.0}versionable, {http://www.alfresco.org/model/content/1.0}auditable, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/system/1.0}localized]


The value of the parameter named "script-ref" is not a reference to a script, but rather a list of its aspects. This is very strange, since querying the database directly gives the node UUID as expected:


select q.local_name, p.string_value from alf_node_properties p, alf_qname q  where p.qname_id = q.id and p.node_id = 239416;
   local_name   |                         string_value                        
—————-+————————————————————–
parameterValue | workspace://SpacesStore/f1a5113c-8a95-497d-aac1-378f41e9b547
parameterName  | script-ref


Is this a bug or a feature?

Outcomes