Thursday, October 24, 2013

Access Teams in CRM 2013

This is another new feature addition in CRM 2013.

What are Access Teams?

In the previous versions of CRM record could be shared to other users or team to provide them access to the records. While sharing the records you could specify the permissions provided to the shared users to that record. The shortcomings here were either you add one user at a time and then specify the permissions for each user at the time of adding (repetitive work) or else pre-create teams and then share the record with the team. If you had a dynamic setup where you could have different set of users working on different records, it would require creating of those many teams to use team sharing. This was not a feasible idea.

Access Teams are based on these same concepts but without the limitations of the earlier Share options.

You can user Access Teams to provide access to records to more than one user and have teams created on the fly as the users are added.

How does it work?

  • Enable the Access Team feature for the desired entity.




  • Define the Access Team Template


         Navigate to Settings --> Administration --> Access Team Templates


In the Access Template you define the permissions to be assigned to the users selected for this Access Profile



The entity will only list those entities for which the Access Team feature is enabled.

You can create multiple templates for any entity. You can then select appropriate template on the entity form.

Add the Access Teams grid on the desired entity form.

Add a subgrid control and set the following properties.


In the Team Template select the Access Template that would like to apply.

All users included in the team grid would be controlled by the access template selected for the grid and would be provided permissions accordingly.

If a user that has user level access permission logs in, they would still be able to view records that were made accessible to them through the Access Teams.

The Team profile defines the privileges assigned.


Behind the scenes
 
  • For every record that you assign team members, a team record is created. So it creates one team per record.
 
  • The team type for this record is set to Access
 
  • The team name is auto generated by concatenating the entity record + the access template record id.
 



Programmatically Add/Remove users from a records Access Team

Read the Access Template ID using the Template name.

The entity that stores Access Template is “teamtemplate

                   //  Query using ConditionExpression and FilterExpression
                    ConditionExpression condition = new ConditionExpression();
                    //attribute name add to condition
                    condition.AttributeName = "teamtemplatename";
                    //operator add to condition
                    condition.Operator = ConditionOperator.Equal;
                    //values added to condition
                    condition.Values.Add(_accessTeamTemplateName);

                    // filter creation
                    FilterExpression filter = new FilterExpression();
                    //condition added
                    filter.Conditions.Add(condition);
                    //   create query expression
                    QueryExpression query = new QueryExpression("teamtemplate");
                    //filter added to query
                    query.Criteria.AddFilter(filter);

                    //retrieve all columns
                    query.ColumnSet = new ColumnSet("teamtemplatename");

                    // execute query which will retrieve the Access team teamplate
                    accessTeamColl = service.RetrieveMultiple(query);


Add user to the Access Team for a record

       //Request to create the Access team and add the user in that access team
                   AddUserToRecordTeamRequest adduser = new AddUserToRecordTeamRequest()
                    {
                        Record = entityToAdd,

                        SystemUserId = UserId,
                        TeamTemplateId = teamTemplateId
                    };
                    // Execute the request.
                   AddUserToRecordTeamResponse response = (AddUserToRecordTeamResponse)service.Execute(adduser);

Similarly you can use the RemoveUserFromRecordTeamRequest to remove users from a particular records access team.


2 comments:

  1. It's worth mentioning these aren't solution aware so when you deploy from dev to live, you need to create the access team templates again and hook them up to your sub-grids

    ReplyDelete