user1202839
user1202839

Reputation: 375

CRM 2013 - linq query to get accounts for a specific owner

I need to get all the account records assigned to the system user. This linq query is not working. What am I doing wrong? `

var accts = from a in xrm.AccountSet
   where a.OwningUser == new CrmEntityReference(SystemUser.EntityLogicalName,  new Guid("<systemUserGuid>"))
   select a;

Upvotes: 0

Views: 152

Answers (1)

Guido Preite
Guido Preite

Reputation: 15138

try with

ar accts = from a in xrm.AccountSet
   where a.OwnerId.Id == new Guid("<systemUserGuid>")
   select a;

Upvotes: 1

Related Questions