AnsweredAssumed Answered

Rule (and its script) not working as expected

Question asked by srowsell on Aug 19, 2013
Latest reply on Aug 20, 2013 by srowsell
I have created a folder and a rule for this folder which will, upon file creation:
- change the node to a new content type (which is a child of cm:content); and
- execute a little script which is meant to populate two of its properties:

var results=search.luceneSearch("+PATH:\"/app:company_home/st:sites/cm:contract-management/cm:documentLibrary/cm:ActiveContracts//*\"+TYPE:\"{duca.contracts.model}contract\"");
var maxContractNumber=0;
for (var i=0;i<results.length;i++)
   if (["contract:contractID"]>maxContractNumber)

(Basically I'm just incrementing the value of contractID so the user doesn't have to.  It's not a terribly meaningful value to a human.)

The node is changed to the content type as expected.  The query works and returns what I expect it to return.  The last two lines, however, appear to do nothing.  They definitely refer to properties of this model.

Can anyone think of a reason why this isn't working?  Does Alfresco just need more time between setting the content type and accessing its properties?