Programmatically change the Business Unit of a Team in Dynamics CRM

We had this requirement recently where we need to change the business unit of teams programmatically. Seemed quite easy since I already had the experience of the using SetBusinessSystemUserRequest while changing the business unit of the user. Hence we assumed that there would be some message likewise for changing Business Unit of the teams also.

However we could not find any. Whenever any doubt, I always fallback to my bible which is Dynamics CRM SDK.

After searching through the SDK, I finally came across the request SetParentTeamRequest which did the trick for me. Below is the code for the same

 

SetParentTeamRequest changeTeamBURequest = new SetParentTeamRequest();
changeTeamBURequest.BusinessId = “<BU ID>”;
changeTeamBURequest.TeamId = “<team ID>”;
service.Execute(changeTeamBURequest);

Hope this helps!

4 thoughts on “Programmatically change the Business Unit of a Team in Dynamics CRM”

  1. Very useful. Do you know if there is a similar programmatic approach to changing the color theme for a user when they logon? If we have multi-tenant environment, trying to have a theme per business unit. Thanks.

Comments are closed.