When you share a record with a team or a user do you know where it is stored in the database? The entity name is PrincipalObjectAccess. This is the entity which stores the shared information.
I have stated below the columns which will have to be populated in this table.
PrincipalId
This field stores information regarding Team/User guid that the record will be shared with.
PrincipalTypeCode
This field stores information regarding whether the record is shared with a team or a user.
Team – Value is 9
User – Value is 8
ObjectId
This field stores information regarding the record that is being shared with a user/team
ObjectTypeCode
This field stores information regarding the shared record entity type code.
e.g.: account – 1
Contact – 2..etc…..
AccessRightsMask
Type of share
e.g.: - read, write
These are the important fields to remember.
SQL script to do this is given below.
INSERT into PrincipalObjectAccess ( PrincipalId, PrincipalTypeCode, ObjectId, ObjectTypeCode, AccessRightsMask,
InheritedAccessRightsMask, ChangedOn)
Values (guid, 9, @aID, (select objecttypecode from entity where logicalname ='account'), 786455, 0, GETDATE()
Thank you.. This will helped me to find out which records are not shared out of 500000 records :-)
ReplyDeleteYou are most welcome.
ReplyDelete