How to create multiple nodes using Rules once? I have a content type named Run that have two entity reference


entity reference field named participants which reference user.
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.
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.