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!

Advertisements

Author: Debajit

I am a Dynamics CRM Most Valuable Professional (MVP) with 10 years of experience in Microsoft .NET Technologies and 7 years of dedicated experience in Microsoft Dynamics CRM. I have worked with companies like Microsoft, SanDisk, PwC, TMF Group and have extensive experience of implementing complex CRM solutions from both offshore and client side. Currently the face of XrmForYou.com with significant experience in delivering corporate training on Dynamics CRM and have already delivered multiple projects to client through XrmForYou.com Author of multiple tools on codeplex including the 'Role Based Views' and 'CRM-Sharepoint Metadata manager & Attachment Extractor' which are available for commercial use under XrmForYou.com For consulting/ training, drop me a note at info@xrmforyou.com or visit our website www.xrmforyou.com

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s