DELETE USER FROM CRM – via SQL commands (DATABASE)
I would like to delete CRM User and not disable the user.
Because of that I must to remove the current user from some CRM tables.
This is unsupported
way for the resolution. Be sure to take a backup of both config DB and CRM DB.
The unsupported command helps to remove this CRM user
- Select SystemUserId from systemuser table
Run the next command:
select SystemUserId from SystemUser where
DomainName like '%Test\Test%'
Save the guid for all other commands.
- Run
the next commands in the orgaxniation Db for instance TEMP_MSCRM
DELETE dbo.SystemUserProfiles where
SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.UserSettingsBase where SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.QueueMembership where
SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.TeamMembership where
SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.xnes_auditBase where
xnes_user = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.xnes_crmlogBase where
xnes_owner = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE dbo.SystemUserRoles where
SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
DELETE SystemUserBase
where SystemUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
- Run the next command in MSCRM_CONFIG DB
delete
SystemUserOrganizations where CrmUserId = 'AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE'
Needs to IISRESET CRM
front servers.
The reason is changes in
MSCRM_CONFIG DB
Enjoy,
Rami Heleg