1

What I want to do is trigger an action when one of the fields on my field collection is changed to a certain value. For example, my 'campaign' node has a field collection with a field called 'status' This status is a list containing 3 options; 'onboard', 'live', or 'dead'. When the field on a campaign node field collection is set to 'live' I want to trigger an action.

So I start by saying:

Events: After node is updated

Conditions: This is the bit I am struggling to work out as I cannot do a data comparison with this particular field.

Action: send email

How can I achieve this?

apaderno
  • 28,547
  • 16
  • 75
  • 90
Rich Stevens
  • 599
  • 4
  • 17
  • Add an 'Entity has field' condition first, and choose the field you're interested in. The next condition you add will be able to use that field – Clive May 21 '13 at 15:23
  • Hi Clive, thanks very much for your reponse but I still cannot see the field. My first condition is "Entity has field Parameter: Entity: [node], Field: field_publisher_status" and then on my next one I want to bascially say 'if field_publisher_status is 'LIVE' then trigger my event but I cannot see this field in my 2nd condition. – Rich Stevens May 22 '13 at 15:59

1 Answers1

0

You may get it to work by using an approach similar to what is mentioned in comment # 4 of issue # 1315566, i.e.:

  1. Create an "entity has field" condition on your Rule.
  2. For the "Data Selector," select the entity that contains the field (in my case, a node). For the "Field" value, select the machine name of the field collection in question.
  3. Go to your action. Using the "Data Selector" mode, you should be able to drill down through the entity in question to all the values contained within the field collection. In my case, the end result is "node:field-enrollee:field-school-district:0:tid"

In your case you try to do what is mentioned in step 3 above as a Rules Condition (instead of a Rules Action). So add a Rules Condition "Entity has field" (prior to being able to use it anywhere later on in your rule), which refers to your field collection field.

For way more details about this, refer to "How to iterate over all field collection items in the Rules module?" (which also includes a rule in export format you may want to experiment with, if you only adapt some machine names of the used fields).

Community
  • 1
  • 1
Pierre.Vriens
  • 2,117
  • 75
  • 29
  • 42