How do I find the user whose field is equal to the email address? I am trying to fetch a Username where a field equals the value of another field.

On my content type, I have an Entity Reference fields that creates a select list of email addresses.



In Rules, reacting on Creating/Updating nodes in this content type, I am trying to Fetch a User Entity where the value the select list field equals the user's email.

How can I do that?



What I have tried:

I first chose to "Fetch Entity by Property".

The Value is "User", the Property was set to "Name", and the Value was set to the title of the Entity Reference field in the first screenshot (The title of each node in the select list is an email address)

The Fetched Entities are called "fetched_user".





When trying to Add a Variable, it shows multiple values, so I assume I would need to make a loop first.



So I created a loop:



I am very lost on what to do next. Can anyone help me?

Thank you.
Your first mistake is in your fetch by property action. The property must be set to email for the users to be found.

After that, the fetch by property action will always return a list even if it's only one result. So you just need fetched-user:0:name. No loop required.

In php, 0 is the first item in a list.