AnsweredAssumed Answered

Cannot read before/after with onUpdateProperties behaviour.

Question asked by lyamamot on Jul 31, 2009
Latest reply on May 23, 2012 by acarpine
I've written a JavaScript-based behaviour to hook into onUpdateProperties for one of my custom types. I would like to take some action when a single property, xx:visibility, changes. I followed the steps outlined in Jeff Potts' excellent guide (http://ecmarchitect.com/archives/2007/09/26/770) and it mostly works, but it seems like Alfresco is not setting the before/after variables as they are "null" in my script. That is, I have this script code:

   if (behaviour.args.length == 3) {
      var node = behaviour.args[0];
      // "node" is set and I can access its properties, even node.properties['xx:visibility'].
      var before = behaviour.args[1];
      var after = behaviour.args[2];
      // "before" and "after" are "null" and not useful. They should represent the state of the properties before and after the change.
   }
Am I missing something? Are these values not available to JavaScript scripts?

Outcomes