I am trying to do this entirely in Rules. I have a Commerce Module product with a film_code field. When a new product is created, I wish to trigger a Rule that looks through all of my Movie content type nodes and find the movie that has the same field with a matching value. Once found, I wish to create an Entity Reference from the Movie node to the product.

I have seen some comments about using PHP to programatically compare field values in different nodes, but can't figure out how to compare two entities entirely within Rules. My guess is that I need to find the value of the new film_code and then run a component that creates a list of the film codes in the Movie nodes and compare them. I can get parts of that running, but it gets over my head. The main concept I am missing is how to deal with two different entities in one Rule.

Any thoughts? Thanks.