Accessing custom taxonomy term fields in a rules loop I am building a rule that on node save will loop through taxonomy terms added to an entity reference (taxonomy term) field, build up a list of users from an entity reference (user) field in those taxonomy terms, and e-mail those users.

The problem I'm having is that my data selector won't give me the tokens for the user reference field in the taxonomy term loop.  This rules issue tells me that I need to have the "entity has field condition" condition applied or the "content is of type" condition.  Unfortunately all my conditions are referencing the node that is being saved.

I'm guessing that the answer would be to build the loop into some type of component so I can do a second condition check, but I'm not sure what the right approach for that would be.  How can I let rules know what kind of entity I'm looping through, so it will give me access to the custom fields on that entity?
Have a look at the question about "How to access commerce_product field of line-items using Rules to flag the Commerce Product?". The accepted answer to it (disclosure: it's mine ...) explains how that question can be solved (also) by creating a Rules Component, and which looks like so:

{ "rules_perform_an_action_on_a_selected_line_item" : {
    "LABEL" : "Perform an action on a selected line item",
    "PLUGIN" : "rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "selected_line_item" : { "label" : "Selected Line Item", "type" : "commerce_line_item" } },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "selected-line-item" ], "field" : "commerce_product" } }
    ],
    "DO" : [
      { "entity_fetch" : {
          "USING" : {
            "type" : "commerce_product",
            "id" : [ "selected-line-item:commerce-product:product-id" ]
          },
          "PROVIDE" : { "entity_fetched" : { "product_fetched" : "Fetched Product" } }
        }
      },
      { "drupal_message" : { "message" : "Some details about this product: Product ID = [product-fetched:product-id], Product SKU = [product-fetched:sku], Product Title = [product-fetched:title], Product Creator = [product-fetched:creator]" } }
    ]
  }
}


Note the parameters used in this Rules Component, i.e. selected_line_item ( = the line item being processed). And also note the type of that parameter (a Commerce line item).

The main rule just executes this Rules Component, as part of a Rules Loop in it, whereas in each iteration of that loop the actual line item being processed is passed as the value for that parameter. So with this example in mind, it seems that this might be a solution to your questions:


  How can I let rules know what kind of entity I'm looping through


The type of the parameter you pass to the Rules Component.


  ... so it will give me access to the custom fields on that entity 


I think your Rules Component would not need any extra Rules Conditions, though if needed (as shown in my Rules Component example with the Rules Condition related to "Commerce Product"), you could add relevant other Rules Conditions if needed.

For the sake of completeness, some more details about that Rules Component:


By adding the Rules Condition, I got access to the value of the id (key) of the Commerce Product that the line item was about.
Since I had made the value of that id (key) of the Commerce Product avaiable, I could use the Rules Action to fetch an entity by id (entity being the Commerce Product). And by doing that, from then on I had ALL the data (fields) of the Commerce Product available.