+ Start a Discussion

Record with user field not returned when user in field is not logged in user

Our app has a custom object that includes a lookup relationship field for Salesforce User.  When the object has exactly one record, and the user specified in the Salesforce User field is not the same as the logged in user, a query returns no records.  It should return the one record, whether the logged in user matches the field or not. After logging in as the user on the record, the query correctly returns the single record.  If the object has more than one record, all records are returned, even if no record has a user matching the logged in user.


Has anyone else seen a problem like this?  If so, how did you get around it?

Jeff MayJeff May

Hard to tell without looking at the code, but I would guess its something with the query.  Are you using the $User object?

We're not using $User, but found the problem. In some cases, another query executed that filtered on Salesforce user.

Thanks for the reply.