你的位置:首页 > 数据库

[数据库]Dynamic CRM 查询实体记录 被共享给了 哪个用户



 --客户表名"new_customer"
 SELECT u.FullName AS 被共享人,a.new_name AS 客户名称,sup.SystemUserid AS 共享人ID,POA.ObjectId AS 共享记录ID FROM PrincipalObjectAccess  POA inner
 join SystemUserPrincipals sup on POA.PrincipalId = sup.PrincipalId  inner join SystemUserBase u
 on sup.SystemUserId=u.SystemUserId inner join dbo.new_customer a
 on a.new_customerId=POA.ObjectId WHERE POA.ObjectId IN (SELECT new_customerId FROM dbo.new_customer)