AnsweredAssumed Answered

Error associating an advanced  workflow by a custom behavior

Question asked by mabayona on Feb 26, 2008
Latest reply on Feb 26, 2008 by mabayona
Using 2.9C_dev, when I associate an advanced workflow to a document in the code activated by a custom behavior, I get the following warning in the logs:

RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object Node Type: {my.model}mycustom_node, Node Aspects: [{http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/application/1.0}uifacets, {http://www.alfresco.org/model/content/1.0}auditable] of class org.alfresco.repo.jscript.ScriptNode where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.

The custom type is subtype of cm:folder and gets created, but when y try to delete it it reports:

Please correct the errors below then click OK. 
Unable to delete Space due to system error: Failed to execute transaction-level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnDeleteNodePolicy.onDeleteNode(org.alfresco.service.cmr.repository.ChildAssociationRef,boolean) in transaction d819420f-e451-11dc-8da4-cf9713cd64b2


and it does not get deleted.

The code that raises the first error is:

var scriptFailed = false;
// Have a look at the behaviour object that should have been passed
if (behaviour == null) {
   logger.log("The behaviour object has not been set.");
   scriptFailed = true;
}
// Check the name of the behaviour
if (behaviour.name == null && behaviour.name != "onCreateNode") {
   logger.log("The behaviour name has not been set correctly.");
   scriptFailed = true;
} else {
   logger.log("Behaviour name: " + behaviour.name);
}
// Check the arguments
if (behaviour.args == null) {
   logger.log("The args have not been set.");
   scriptFailed = true;
} else {
   if (behaviour.args.length == 1) {
      var register= behaviour.args[0].child;
      var operation = register.parent.parent;
      
      var pipeline = operation.parent;
      var children = pipeline.children;
      var phase = "";
      
      if (children != null && children.length > 0) {
         for (i in children) {
            var child = children[i];
            if (child.properties.name == "Fase Name") {
               fase_origin= child;
            }
         }
         
         if (fase_origin != "") {
            operation.move(fase_origin);
            logger.log("Operation moved");
         }
      }
      
      operation.save();



        }
}

Any idea why…

Outcomes