Microsoft CRM is very dynamic platform, it is helping collaborate and interact with team members. One of the cool features on Microsoft CRM, you can built View and share it with other team members.. But what happen, if you as an end user want to see this view anymore and you don’t have control to remove it! on this post, we will show you how to remove the shared CRM view from database.
Because of the nature MS CRM dynamicity, there will be a challenge to figure out and delete the sharing metadata.
The good side of this, all metadata is stored in the MS CRM database, thus you can manage that by updating database. I would like to highlight here, this is not recommended by Microsoft and you can do it in case you ran out of options but there is no guarantee from Microsoft this is will be working for you as well. I personally tried couple of times and worked fine with me.
I’m strongly recommend to take backup of your database before applying this change, so you have a backup point in case something went wrong.
DECLARE @userId UNIQUEIDENTIFIER = 'User ID whom have the view shared'
update PrincipalObjectAccess
set AccessRightsMask = 0 --Remove sharing
where PrincipalObjectAccessId in(
select poa.PrincipalObjectAccessId
from PrincipalObjectAccess poa
inner join FilteredSystemUser u
on u.systemuserid = poa.PrincipalId
inner join UserQuery uq
on uq.UserQueryId = poa.ObjectId
where
poa.ObjectTypeCode = 4230
and u.systemuserid = @userId
and uq.Name in(
'Target View Name to remove it'
)
)