AnsweredAssumed Answered

Need to move a node to a parent of a search result

Question asked by srowsell on Aug 20, 2013
Latest reply on Aug 23, 2013 by srowsell
I have a script in Share which looks like this:


var contractID=document.properties["contract:contractID"];
var results=search.luceneSearch("+PATH:\"/app:company_home/st:sites/cm:contract-management/cm:documentLibrary//*\" +TYPE:\"{duca.contracts.model}contract\"");

if (contractID!=null)
{
   for (var i=0;i<results.length;i++)
   {
      if (results.properties["contract:contractID"]==contractID)
      {
         document.move(results.parent);
         break;
      }
   }
   
}


The idea is that the user will update a property, which will trigger a rule, which will execute this script.  The search will return at least one result – the one whose contractID property matches the one of the file that was just updated – and then move the just-updated document into the same folder as the document which was found in the search.

My problem, I think, is just the syntax of the parent node.  Are there any insights better than mine?

Outcomes