My configuration is the following :

Using D7

I have a node type called Items.

User with a node id entity reference field to this node can be affiliated to one of these nodes, four of them..

(So there is (x) Users who are affiliated to Node A, (x) Users to Node B.. C and so on..)

When registering new user has a "field_current_owner" (on/off), set by defaut And choose his affiliation to one of these four nodes.

I want to make a rule that cycle through other users affiliated to the same "node id reference" to have their "field_current_owner" switch off.

I am a bit confused with rules components.. someone could shade some light on my problem ?

Should i made a component which turn any user with id different (negate) than registered user with condition regisetred has same node id reference trigger event get field i/o to "off" ?

I am a bit confused, then when i make a rule with my component fields previously inputed, how can I make it cycle through my user list ?

I am a bit in the mist with this module, can someone please give me hand ? Even a hint ?

Thanks by advance

  • I make it cycle through my user list ? Click on Add a Loop first (which you set to your Entity Reference field, this creates a list_item) then add your component and pass the list_item (which would be the user id). Then your component uses this user id to switch off field_current_owner
    – No Sssweat
    Aug 14, 2017 at 23:11

1 Answer 1


Assuming your Rules event is User Updated and you don't have hundreds / thousands of users referencing each of the nodes,

Use the Action: Fetch Entity by Property [User>Entity Reference Field] and give it the Entity Reference of the Updated User. This will give you a list called Entity Fetched.

  1. Create a Loop using Entity Fetched

  2. Add an action to the Loop (on the right) and Set a Data Value: [List Item>Field>Not Current Owner]

  3. Under the loop, Set a Data Value: [Updated User>Field>Current Owner]

That will save each user that references the node.

If you don't want that because of performance etc.,

  1. You would create a Rules component and send each List Item in Step 2 above.

  2. Then in that rule component, have a condition that checks the user's Current Owner field is set to True, and have an action to set it to false.

  3. Do step 3 as above in the main Rule to set the current user as owner.

  • Hey ! Thank you, Solution 1 works like a charm pastebin.com/3MEFwsYD Aug 15, 2017 at 15:39
  • Could you detail on solution 2 ? Should i create a rule component with 2 variables for Set a Data Value: [List Item>Field>Not Current Owner] and then two variables for its condition (Current Owner field) > true, put it in a rule with step 3 ? I am planning to have 50+ users affiliated (at best) to each node, do i need your second solution ? Aug 15, 2017 at 15:46
  • Na, the first solution is fine then. But for the rule component, you would just need one variable (Parameter: Data Type: User) and then in the rule, add the condition for owner field and have the appropriate action. Aug 15, 2017 at 15:56
  • I will stick to a simple rule then, thank you for your help :) Aug 15, 2017 at 16:47

Your Answer

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

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