Dear community. 
I'm trying to apply a template for ICMP monitoring to devices that are under specific containers and I'm having issues with the Automatic apply rule configuration
for (p : $node->parents) {
   if (p->type == 5 && (p->id==109031 || p->id==42342))
      return true;
}
What would be the best way to apply a template if the device is under specific containers?
Has someone used the new function isDirectParent(object)?
Thank you
 
			
			
			
				chances are that adding
else
{
  return false;
}
will fix the issue. 
In overall you can use
trace(0, "your debug");
PollerTrace("your debug");
to debug what's happeing. First one adds to server log, the latter - to the output of poll messages when you do e.g. Configuration poll from node's context menu. 
			
			
			
				In addition to what Filipp stated the screenshot attached does not actually match the code in the message.  You simply have return; and not return true;.  I would probably not include the return false; in an else clause either, but simply as the last statement so that anything falling through gets tagged like this.  
			
			
			
				The code that worked is:
Thanks Filipp/Iweidig
parents = GetNodeParents($node);
for (p : parents) {
   if (p->type == 5 && (p->id==109031 || p->id==55839 ||p->id==177))
        {
      
      return true;
   }
}
return false;
			
			
			
				Glad to hear it is working, mark topic [SOLVED]!