5

I am trying to set up a RUle that loads and node (Fetch entity by id) and then, on another action, I want to access fields of the fetched entity. However, while I see the loaded node on the data selector of the next actions, I cannot seem to access its fields, only its "normal properties".

Any ideas?

2

I got to this question whilst searching for a different solution to my own problem, but I think I know what's wrong anyway, even if it's 2 years old, it might help someone in the future :P

I think you have to add a condition to determine the type of Entity you are looking at, either by using 'Entity has field' or 'Data comparison' to determine what content type you are looking at. The reason you only see the 'normal properties' by which I assume you mean NID, Author, Title etc, is because it cannot guarantee it has the fields you want, until you determine what content type it is

2

You can use the rules_conditional module This module gives you the option to add conditions in the actions area:

example of the rules_conditional module

1

For anyone still looking for an answer to this, I used a workaround for my case.

I wanted to get field data on a node that was two links away from the one I had in rules. Loading the first referenced node was simple enough, but to load the second one I had to use PHP in the field that I eventually wanted the data to be outputted in and use node_load. Theoretically this would work for any level of separation.

This probably won't work for a lot of cases, but it might be useful for a couple.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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