How to check with Rules if a new element has been added to a list in a node? I'm using the Rules module and I would like to make a rule to check wheter a new element has been added to a list in a node.

First I have tried "List Count comparison" but it can only compare a list to an integer, then I have tried with a custom php code condition but I have troubles with getting the right data. i don't understand if i'm missing something and there is a simple way or it can be done only with custom php code (in which case i'd like to know how to correctly do it, it's worth telling that the list is an entity reference)

This is the PHP code i have tried. The event is "After the update of an existing content of type Q&amp;A", so I have $node and $node_unchanged available. The field is called field_lista_gestori and contains a list of users.

$gestoriCount=count($node-&gt;field_lista_gestori)&gt;count($node_unchanged-&gt;field_lista_gestori);
return $gestoriCount;


But then I have discovered that field_lista_gestori just contains a number (which I think is the reference ID) and I haven't made any other attempts after this.
You're counting the wrong thing...item data is a bit further down the rabbit hole (inside the language array):

$count_new = count($node-&gt;field_lista_gestori[$node-&gt;language]);
$count_orig = count($node_unchanged-&gt;field_lista_gestori[$node-&gt;language]);