1

I have the following setup where I have 2 content types called BRIEFS and IDEAS. On BRIEFS, I have a list of users selected in a field called brief_recipients which is a user reference field.

IDEAS has a entity reference field (associated_brief) that references a BRIEF.

Currently when I create an IDEA, it will email the author of the referenced BRIEF. This works using the following rules setup:

enter image description here

Now I'm trying to add in a LOOP to access the entityfield associated_brief's > brief_recipients field and email them too.

But the problem seems to be that Rules cannot drill down into an entityfield's fields as I can only get to body and author only as seen here:

enter image description here

Now the question is how do you drill down into an entity field's fields? Or is there another suggested way of doing this?

Which hook would I need to tap into if I had to write this custom?

1
  • Best to stick to one question. Aug 18, 2015 at 6:26

1 Answer 1

4

In my scattered experience with rules, a limitation on what data you can access is usually a safeguard because the data has not been confirmed to exist yet. In the Rules conditions, create "entity has field" condition twice.

1) Rule Conditions > Entity has field Data selector: node Field: field-associated-brief

This is your entity reference field, and gives Rules the comfort of knowing the reference field is usable. Once you have the above conditions, rules will load up the referenced fields from your node

2) Rule Conditions > Entity has field Data selector: node:field-associated-brief Field: field-breif-recipients

3) Now the action is able to use the field confirmed in the conditions

Even if you do not think the conditions should be required, it is good practice to confirm you have the data before you try to use it. Here is another person who had a very similar issue

3
  • ok that works! just tried it by adding in the field and selecting via the dropdown the target field to expose. screenshot: prntscr.com/86929p Aug 19, 2015 at 0:05
  • Now how would one get the node path of that referenced entity? i want to put that in the body of email message. Aug 19, 2015 at 22:57
  • nvm i got it! you just have to do the same thing but this type select Entity as Node from the drop down. Aug 19, 2015 at 23:04

Your Answer

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

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