AnsweredAssumed Answered

Rule to check for comments

Question asked by kavilash23 on Oct 13, 2014
Hi Guys,

I have set up an alfresco share rule which allows to move a document from one folder to another through the simple workflow if that document has a comment. So I wrote a script which gets executed by a second rule when the document enters the destination folder.
The script is as follows;

var disAssoc = document.childAssocs["fm:discussion"];
if (disAssoc != undefined){
  disAssoc = document.childAssocs["fm:discussion"][0];
  var commentCount = document.properties["fm:commentCount"];
  if(commentCount >= 1){
   logger.log("Comment added");
  }
}else{
 
  logger.log("No association found");
  throw "No association found";
}

That script works fine when executed from the javascript console but for some reasons it does not work when executed through a rule. It looks like it cannot find the association when executed from a rule.

Can someone please advise?

Outcomes