Dynamics Crm 2013 Access Teams – Demysitified

By now many of you might have already explored the concept of Access Teams that has been introduced with CRM 2013. If not then I would suggest to go through it. Personally i kind of liked it as it helped me to escape sufficient amount of coding in my current project.
In this post, I will not explain how CRM 2013 Access Teams work functionally. But I would rather explore as to what does CRM do underneath to make it work.
I have logged in to CRM with a user who has sales person security role in CRM. I have a custom entity called ‘Test Entity 1’ in my CRM. The sales person security has the following privileges on the Test Entity 1. Check for the screenshot below.
screen 30
Now I have also created an access team template for Test Entity 1. I have configured the Access Teams on the form of Test Entity 1 and opened a record of the entity called ‘Test Entity Record 1‘. Check for the screenshots below.
screen 31
screen 32
Now I go ahead and add the user ‘Test Crm User 1′ in the access teams grid of the opened record. The user now have the privileges to this record as per provided in the access team templates.
screen 33
Let’s check now how is this made possible in CRM.
I open SQL server database and query the Teams table order by createdon descending and following is the result i get.
screen 34
Carefully look at the Team Name – 33835ea1-978d-e311-b84b-463500000031+5c2bde09-60c8-e311-9bb1-463500000031
Let’s check what the first guid refers to. When I query the PrincipalObjectAccess table with the ObjectId = 33835ea1-978d-e311-b84b-463500000031′, the following is result I get.
screen 35
Here objecttypecode = 10005 in my system is the Test Entity 1 entity. So CRM underneath created a new Team and shared the record with the newly created team. The principalid field value is nothing but the ID of the team.
So now let’s explore the second guid of the team name  – ‘5c2bde09-60c8-e311-9bb1-463500000031′.
This is nothing else but the id of the access team template. Please check for the screenshot below.screen 36
Now what happened to the user that has been added to the access team. Let’s pull out the team from the advanced find view.
screen 37
screen 38
 
screen 39
So we can see that user is added as a member of the team. So if one more user is added to the access team, internally crm would add the user as a member of this team
Hope this helps you in understanding the underlying structure of CRM 2013 Access teams.