locked
How to change business unit of an user? RRS feed

  • Question

  • Hi All,

    In crm 2011 is there any way to change the business unit of an user? If possible, then any c# coding help?

    Thanks,

    Mohak

    Wednesday, May 8, 2013 2:23 PM

Answers

  • Here is some sample code - courtesy of Jamie Miley

    SetBusinessSystemUserRequest req = new SetBusinessSystemUserRequest();
    //business unit to assign user to
    req.BusinessId = new Guid("9225A2E5-4970-E011-8D78-1CC1DEE8DA78");
    
    //user to re-assign
    req.UserId = new Guid("E497532F-D37C-E011-8D72-1CC1DEE8EA49");
    
    //can be a different team or systemuser, used to reassign records owned by person
    req.ReassignPrincipal = new EntityReference("systemuser", new Guid("F97371A0-E669-45C7-B611-267E7F2B7E9F"));
    
    SetBusinessSystemUserResponse resp = (SetBusinessSystemUserResponse)service.Execute(req);

    Change Business Unit for System User in Microsoft Dynamics CRM 2011 in Jscript or .NET


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Wednesday, May 8, 2013 2:26 PM
    Moderator
  • I don't know the exact requirement but You can do it manually also.

    Go to User entity, select the User on the ribbon you can find "Change Business Unit", and you can select the business unit from the Lookup.

    Hope this is helpful.

    Let me know the exact requirement i may help.


    Puneet Joshi - Dynamics CRM Developer

    Wednesday, May 8, 2013 6:21 PM

All replies

  • Here is some sample code - courtesy of Jamie Miley

    SetBusinessSystemUserRequest req = new SetBusinessSystemUserRequest();
    //business unit to assign user to
    req.BusinessId = new Guid("9225A2E5-4970-E011-8D78-1CC1DEE8DA78");
    
    //user to re-assign
    req.UserId = new Guid("E497532F-D37C-E011-8D72-1CC1DEE8EA49");
    
    //can be a different team or systemuser, used to reassign records owned by person
    req.ReassignPrincipal = new EntityReference("systemuser", new Guid("F97371A0-E669-45C7-B611-267E7F2B7E9F"));
    
    SetBusinessSystemUserResponse resp = (SetBusinessSystemUserResponse)service.Execute(req);

    Change Business Unit for System User in Microsoft Dynamics CRM 2011 in Jscript or .NET


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Wednesday, May 8, 2013 2:26 PM
    Moderator
  • I don't know the exact requirement but You can do it manually also.

    Go to User entity, select the User on the ribbon you can find "Change Business Unit", and you can select the business unit from the Lookup.

    Hope this is helpful.

    Let me know the exact requirement i may help.


    Puneet Joshi - Dynamics CRM Developer

    Wednesday, May 8, 2013 6:21 PM