3

I have two node types: Item and Order. I have an entity reference (field_items) set up on the Order content type which references Item (1 Order to N Items).

The Item has a field (field_reservation_status) which is a drop-down list of strings.

I am trying to set up a rule so that when I allocate an Item to an Order on the Order form, the reservation status on the related Item will be set to "Reserved".

I am doing this with a reacting rule and a rule component as follows.

Rule component

Condition: Node is of type "Item"

Action: Set a data value (this should set field_reservation_status on the node that the component is actioning to "Reserved")

Reacting rule

Event: When a content node is saved

Condition: Node is of type "Order"

Action: Add a variable (this should store field_items for the current Order node)

Then

Action: Call the rule component

Questions

  1. In the rules config UI I can't see any "Add Loop" button - is this to be expected in version D8 Alpha 3?

  2. What data selector should I use for accessing field_items on the Order node that has just been saved?

  3. What data selector should I use in the rules component to access field_reservation_status on the current object from field_items?

  4. How do I set up a loop over the variable that is created in the reacting rule?

No doubt I'll have more questions.

1
  1. In the rules config UI I can't see any "Add Loop" button - is this to be expected in version D8 Alpha 3?

yes ... as per the issue about Implement Loop UI.

  1. What data selector should I use for accessing field_items on the Order node that has just been saved?

I doubt this is possible in the D8-alfa3 release of Rules. Though you may want to retry using the D8-dev release ...

  1. What data selector should I use in the rules component to access field_reservation_status on the current object from field_items?

Refer to my answer to "2." above ...

  1. How do I set up a loop over the variable that is created in the reacting rule?

Refer to my answer to "1." above ...

PS: No doubt you'll run into more-of-the-same issues using any of the currently available releases of Rules for D8. However, using the D8-dev release is currently your best bet/alternative.

  • Okay, so this has solved the issue to a point. I was getting error messages about fields not existing etc and I no longer get any error messages. However, the rule doesn't seem to have the desired effect. – James Naish Jan 17 '18 at 19:07

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.