How to make a rule select all users of a role? I have a certain content type in which I have a user entity reference select list that is invisible to users/editors.

The idea is that the creator of the request has to choose a role of employees to who he sends this node, and then the other users can either accept or reject it, and only if ALL employees reject, the node would actually go to a rejected state, unlike the usual way of working with workbench.

To do this, I have the invisible user-entity reference field. Now I want to achieve the following:


When creating the node, after save, I want the reference field to automatically select all the users of the chosen role
By clicking a button 'reject', I want to remove the current user from the selected list.
When no users are selected, the node gets rejected.


Option 2 &amp; 3 are easily done with rules. However, phase 1 is where I'm struggling. So I have the complete list of users, but now I have to "select" them, which I can do with rules by using "add to list". However, the selector only gives me the options "entities" and "site", in which site only includes "current-user", "current-page" and "feed-node".

How can I make it select all users of a certain roles?
It appears to me that there is a straight forward solution to have your rule process all those users of a certain role (as in your question): you could an approach to process the results of a VBO enabled view via Rules, whereas your rule performs 2 Rules Actions:


load the VBO list of users that you want to be processed (= those users of a certain role).
add a loop to perform a Rules Action, probably similar to the rule you already have in place, for each user contained in your Views results.


For more details, have a look at the tutorial "How to process the results of a VBO enabled view via Rules?".