AnsweredAssumed Answered

Cascade of INBOUND Rules are not working

Question asked by sbroussi on May 31, 2006
Latest reply on May 31, 2006 by kevinr
Hi,

I want to cascade some INBOUND Rule:
- folder A (drop zone)
  rule R1: import all incoming ACP files in folder B

- folder B (incoming files)
  rule R2: set a custom property to "new document"

Steps:
1) Using FTP, I post one ACP file in folder A.
2) The rule 1 is well played, the ACP is imported
    in the folder B
3) problem starts here…: The rule R2 see new
    incoming files, but the Javascript crashes
    on the line "document.save()" (see below) with a:
java.lang.NullPointerException
   at org.alfresco.repo.jscript.Node.save(Node.java:785)
4) After this crash, the database is corrupted (mySql, innoDB seems to be here but the transaction is not rollbacked).

Note that using the Web Client, I can play this script on a document
(Run action / execute a script). There is no error.

The script looks like:
if (document != null)
{
   // add the "myAspect" aspect and set the "stampStatus" to: "ToBeStamped"
   if (document.hasAspect("corp:myAspect"))
   {
      document.properties["corp:stampStatus"] = "ToBeStamped";
   }
   else
   {
      var props = new Array(1);
      props["corp:stampStatus"] = "ToBeStamped";
      document.addAspect("corp:myAspect", props);
   }
   document.save();
}

Outcomes