function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
richardc_rsvprichardc_rsvp 

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?

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

Thanks for the reply.