use EntityFieldQuery to find user based on profile field value I have a field within the user's profile set with their payroll. What I'm trying to achieve within my module is find the uid, based on the value of a payroll field.

I've tried a few things, but I can't get it to work. What I'm currently trying is this, but it returns unknown field of user

$query = new EntityFieldQuery();

$query-&gt;entityCondition('entity_type', 'user')
  -&gt;fieldCondition('user', 'field_user_payroll', $payroll, '=');

$result = $query-&gt;execute();
$account = user_load($result);

$wrapper = entity_metadata_wrapper('user', $account);
$mimemail = $wrapper-&gt;mimemail-&gt;raw();

watchdog('Photo Import', "Mimemail: %mimemail", 
  array('%mimemail' =&gt; $mimemail), WATCHDOG_INFO);


Any help would be really appreciated. It's driving me crazy!
$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'user')
  -&gt;fieldCondition('field_user_payroll', 'value', $payroll, '=');
$results = $query-&gt;execute();

$users = user_load_multiple(array_keys($results['user']));
foreach($users as $user) {
    $wrapper = entity_metadata_wrapper('user', $account);
    $mimemail = $wrapper-&gt;mimemail-&gt;raw();

    watchdog('Photo Import', "Mimemail: %mimemail", array('%mimemail' =&gt; $mimemail), WATCHDOG_INFO);
}


as per EntityFieldQuery::fieldCondition(), EntityFieldQuery doc

......