Sharing access in Dynamics CRM

By | February 4, 2010

Dynamics CRM has the concept of record ownership. A record can only be owned by single user and not by a team or more than one users. Depending on the security roles defined it is possible to restrict a user to have access to only records owned by them.

However in most practical situation where people work in teams it would be required to allow a group of persons to have access to certain records in addition to the records owned by them. In such case you can use the concept of “Sharing” that is available in Dynamics CRM. Note when you share a record with a group you are only making the record accessible to them and for all other purposes the owner is still the original user and a single user at that.

To share records, first select the records you want to share. On the Actions toolbar, click More Actions, and then click Sharing. As shown in the below screenshot.

When you share a record, you can define the level of permission that you would like to provide the other users with whom you wish to share the record.

Now in the above screen a record has been shared with Brian giving him all permission to the record except delete. This enables Brian to be able to view this record in the Active Records view and also update the record or create activities for this record.

However Anton can only see the record in his active view. But when he open the record it will be available in read-only mode and he would not be able to make any changes to this record.

Programmatically the sharing is controlled by SecurityPrincipal object. To get a list of users/teams with which a record has been shared you will need to use the RetrieveSharedPrincipalsAndAccess message. This message needs to be provided with the TargetOwned Class. If you provide an instance of an account to this message. It will return an array of PrincipalAccess class that will list out all the users/teams and the level of access of each of these on the entity provided. This message can be excuted using the Execute method of the CRM service class.

Other messages to look out for are
GrantAccessRequest
ModifyAccessRequest
RetrievePrincipalAccessRequest

——————————————————-
Posted by: Inogic
For more information/discussions (documents, sample code snippets, detailed work flow or diagrams),
Please be free to visit the following links or email us:
Web: http://www.inogic.com
Blog: http://inogic.blogspot.com
Email: news@inogic.com
—————————————————–

Leave a Reply