1

I have a content type "Event" that's linked to a registration type.

Inside rules I want to trigger the action only if a field value from the host entity is "Open" (it's a checkbox field).

Under actions I'm able to fetch the host entity and access this field but i'm baffled how to access the same field under conditions. How can I go about this?

Thanks.

  • which type of rule you created? – vgoradiya Aug 18 '15 at 7:24
  • Just a "normal" rule for now.. – Chiko Aug 18 '15 at 7:26
  • means which event ? – vgoradiya Aug 18 '15 at 7:30
  • add in conditions data comparison select field and set equal to select your value. done. – vgoradiya Aug 18 '15 at 7:32
  • The event is "After saving a new registration" – Chiko Aug 18 '15 at 7:32
1

You have to first add conditions that allow the rule to know what fields are available.

To do this you can use combinations of the following conditions:

  • Entity exists by property
  • Entity has field
  • Entity is new
  • Entity is of bundle
  • Entity is of type

Those conditions help rules identify the entity and bundle so it can show the relevant fields.

You can then access those field tokens in subsequent conditions and actions.

For example, you might use Entity is of bundle "Event" to then get access to fields used on the event content type.

In your case where you only have access to he user/profile entity you would have to add a condition like above to determine the entity/bundle of the user/profile so that you could get access to the field that references the event.

Then have an action to load the event entity (you could use the action "Fetch entity by id") using the entity id in that field.

Then you could add an if condition in the actions (using the conditional rules module) and say if the fetched entity is of type "Event" then if the value of your field is "Open" then do your final action.

It's a bit complex but you should be able to achieve what you want using the conditional rules module. I think though that this will only work if you have a field on the user that references the event.

If it is the other way around and you have a field on the event that references the user then it would work differently.

In that case I would use the "Fetch entity by property" action to fetch content where the checkbox field = "Open".

  • Thanks. I've tried to add those conditions but in the data selector for any of your listed conditions, I only have available "site information" and "created registration" no reference to anything else. – Chiko Aug 18 '15 at 7:37
  • I updated my answer to add more detailed examples. – rooby Aug 18 '15 at 7:57

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.