locked
CRM 2011: PrincipalEntityMap records missing for users created through SDK RRS feed

  • Question

  • We have created a bunch of users in CRM 2011 using the SDK.

    Everything seems to work fine, until these users started to create their own User Dashboards.

    The users could create their own User Dashboards. However, once they created them, they could not see them. They were not in their list of Dashboards - only the System Dashboards where there.

    There were no errors in the event viewer or even the trace logs.

    I used SQL Profiler to see what it was doing and I discovered it was checking the PrincipalEntityMap table for principals that had an objecttypecode of 1031 - which is the User Dashboard (called UserForm).

    How do these records get created?

    I can write a SQL script to populate the database with these missing records. What I would like to know is why they are missing? Any ideas?

    For information - the following SQL is what CRM uses to retrieve the list of user dashboards. It is joining on PrincipalEntityMap. Where do the records for PrincipalEntityMap come from?

    exec sp_executesql N'select 
    top 5001 "userform0".UserFormId as "userformid"
    , "userform0".Name as "name"
    , "userform0".Description as "description" 
    from
     UserFormBase as "userform0" 
    where
     (("userform0".Type = @Type0) and ("userform0".OwnerId in (select pem.PrincipalId from PrincipalEntityMap pem join SystemUserPrincipals sup on pem.PrincipalId = sup.PrincipalId where sup.SystemUserId = @UserIdOwnerCommand00 and pem.ObjectTypeCode = @OtcOwnerCommand00)
     or "userform0".UserFormId in (select ObjectId from fn_POARetrieveMultiple(@SystemUserId0, @ObjectTypeCode0)))) order by
     "userform0".Name asc
    , "userform0".UserFormId asc',N'@Type0 int,@UserIdOwnerCommand00 uniqueidentifier,@OtcOwnerCommand00 int,@SystemUserId0 uniqueidentifier,@ObjectTypeCode0 int',@Type0=0,@UserIdOwnerCommand00='16A583B7-4E1D-E411-A0FA-00155D5D3B03',@OtcOwnerCommand00=1031,@SystemUserId0='16A583B7-4E1D-E411-A0FA-00155D5D3B03',@ObjectTypeCode0=1031
    I have asked this on SO too - no luck - here is the link 



    • Edited by DonalDev Thursday, August 28, 2014 9:58 PM
    Thursday, August 28, 2014 9:57 PM