Customer Engagement & Dynamics CRM Forum

Resetting Existing SystemUser Record with new AD user account

  • 1.  Resetting Existing SystemUser Record with new AD user account

    Posted 16 days ago
    The procedure I am about to describe worked for us on-prem in version 8.2.  I am currently refactoring our customizations for 9.1 on-prem.

    I have created workflows that run our employee intake.  One of the situations we have to deal with is returning employees.  Please note the following:
    1. When an employee leaves, we delete their Active Directory account.
    2. Obviously, the CRM systemuser record remains since they cannot be deleted.
    3. If an employee returns, re-enabling their systemuser record won't work since their NEW AD account has a different GUID than the AD account referenced on the existing systemuser record.
    So, to resolve this problem, we did the following:
    1. Created one  "dummy" AD account called "Reinstate Employee".
    2. We change the existing systemuser domainname to reference this dummy AD account and save the record.
    3. We change the existing systemuser domainname to the user's correct domain name that references the employees NEW AD account.  This updates the GUID on the system user record and all works fine moving forward.

    1. While this works fine when I (as a system admin) do this using the UI, it does NOT work when I try and do the EXACT same thing in a custom workflow activity.  Attempts get an "Access is denied" error message.
    2. The account used in the activity is the base CRM admin account used when creating our organization and BU.

    Below is a copy of my code and as you can see, it is pretty simple.  Could someone please advise on a possible solution to this issue?  Any help would be greatly appreciated.

    Dim updUser As New Entity("systemuser")
    updUser.Id = userRec.Id {I verified that this is a valid GUID for the correct user record}
    updUser("domainname") = domainPrefix & "remployee" {domainPrefix is correct and from a file containing system variables}


    Glen Wolinsky
    Lead Applications Developer
    Miller & Martin PLLC
    Chattanooga GA
    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready

If you've found this thread useful, dive deeper into User Group community content by role