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?

  • Best to stick to one question. – othermachines Aug 18 '15 at 6:26
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

  • 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 – Patoshi パトシ Aug 19 '15 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. – Patoshi パトシ Aug 19 '15 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. – Patoshi パトシ Aug 19 '15 at 23:04

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.