I have a content type named Run that have two entity reference

  1. entity reference field named participants which reference user.
  2. entity reference field named examinations which reference content type Examination.

I want to use Rules to create multiple nodes of content type "Results" for each user "participant" referenced in "Run". the number of Results nodes equals the number of examination.

So I created a rule that fires when the user views the node of type run and I made a loop through examination and I created results node. This runs OK for the first time. But when the user views the node again the nodes are duplicated n times as per number of node views.

Any suggestions how I can make the rule run once per user? Or any other work around.

1 Answer 1


You could use the Flag module and define a none global flag used to flag nodes of type "Run" (name the flag whatever you want).

Then extend your existing Rule like so:

  • Add an extra Rules Action to flag that node of type "Run" (to indicate that the rule was executed a first time for that user).
  • Add an extra Rules Condition to check that the node was NOT yet flagged by the user viewing the node.

Using this approach, you have a mechanisme in place that allows you to keep track of the users for which your rule was yes or no executed exactly 1 time.

  • Thank you for your reply, I will try the flag module but there is a little bit issue that I can found before I try the solution. if the admin edit the node and add more examinations after the user viewed for the first time. the newly added examination will be ignored if he viewed again. and the results will be added for the old examination only. Commented Nov 8, 2016 at 9:30
  • OK I will try this and I will create a new question for the new issue, Thanks a lot for your replies Commented Nov 8, 2016 at 9:35
  • I tried the solution and worked perfectly,Thanks :) Commented Nov 8, 2016 at 11:50
  • @MohamedAtia : Great! Merci for the confirmation (and accept). Can't wait to see your followup question appear related to your first comment here, OK? Commented Nov 8, 2016 at 11:56

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.