web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Assign records to ex manager when changing to new manager

(0) ShareShare
ReportReport
Posted on by 445

Hi,

When a user's manager is changed, till that date all the records of that user should be automatically assigned to the ex manager and whatever the new records the user is creating, it only should be assigned to the new manager.

Is there a way to achieve this?

Thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at
    RE: Assign records to ex manager when changing to new manager

    You can create a plugin that will execute on the Update of the User record (when the manager field changes).

    You will need to create an Pre-Image of the entity (before the change), so that you can get the old manager id.

    Within your plugin, call the ReassignObjectsSystemUserRequest as shown below:

    ReassignObjectsSystemUserRequest req = new ReassignObjectsSystemUserRequest();

    //The user who's records will be reassigned

    req.UserId = new Guid("ASSIGN_FROM_USER_GUID");

    //The new user to receive the records

    req.ReassignPrincipal = new EntityReference("systemuser", new Guid("ASSIGN_TO_USER_GUID"));

    ReassignObjectsSystemUserResponse resp = (ReassignObjectsSystemUserResponse)service.Execute(req);

    Hope this helps.

  • Elangamban Profile Picture
    445 on at
    RE: Assign records to ex manager when changing to new manager

    I don't know about creating plugin, but I'll give it a try.

    Thanks.

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at
    RE: Assign records to ex manager when changing to new manager

    Here is a sample link to how to create a plugin:

    msdn.microsoft.com/.../gg594416.aspx

    You can also download the Microsoft Dynamics CRM SDK, which has some samples there.

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans