Context: drupal 7, views, Rules, Views_rules

Goal: to send an email to all users that have the same taxonomy-term as the newly posted node

Possible solutions known to me:

(1) A Rule calls the view with mailadresses and terms of each user. I would need to evaluate a condition within the view loop, which is possible, using a component of type rule or ruleset that will be executed for each item in the loop. This will be inefficient (give a lot of “skip this”).

(2) Or I could make a view for each term, as proposed in the comments of How to send out email based on matching taxonomy terms in user profiles? However, I would prefer to give my users more flexibility then just a few options.

Question: How could I pass the taxonomy-term to be used in the filter-criteria in the view? The view would then only return the records where actually something has to be done (i.e. send a mail to). Is there a way to send an argument when calling the view loop?

  • use this module: drupal.org/project/views_rules
    – pinueve
    Commented Sep 11, 2017 at 19:03
  • I do: views_rules module provides a way to pass the result from the view (a set of records) to be used in a rules action. I would like to add some argument when calling the view in the action: add view loop with filter-parameter "xxx", where "xxx" can change depending on the content of the node that was saved.
    – sigridt
    Commented Sep 12, 2017 at 15:28
  • add your taxonomy as a field (a relationship may help), and use rules-conditional module, in your actions check that field value and modify your rules behaivior, be carefull, to check taxonomy values, you must check TID and not field value or taxonomy term, good luck!
    – pinueve
    Commented Sep 12, 2017 at 16:42

1 Answer 1


I found 2 working prototypes. Each require a taxonomy-list "field of interest" in both user and node.

Users can select multiple items, according to their fields of interest. When registering a new post, the posting user can indicate in which field of interest (one) this post is matching.


using 5 views (one for each term) to select the email adresses of users interested in this "field of interest". In the action I use "switch case" (from conditional_rules) to select the view corresponding to taxonomy-term of the new node


fetch entity (user) by taxonomy term(field of interest)

loop thru the list of users


Finally I chose to make 5 views and 5 reaction rules, each rule having as condition a particular value of the taxonomie term in the new node en using the relevant view to select the users. No switch case needed.

  • When refining the prototype it seems necessary to use switch-case in prototype TWO as well. (different type of variable : user can select multiple fields of interest while the node is set to accept only one value)
    – sigridt
    Commented Sep 20, 2017 at 17:47
  • After all, I could not get TWO working with real data. So I will be using the 5 views and select which view to use with a "switch case" based on the value of the new node's field of interest. This also gives me the possibility to add additonal conditions, such as to select only active users.
    – sigridt
    Commented Sep 20, 2017 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.