Tuesday, September 24, 2013

Reset Default Org for CRM Users

The script below will change the default org for users.  This can be helpful if you have disabled the original default org and users are now getting the crm error that the organization has been disabled.  Just change the @NewOrgName value to the value of your database name without the _MSCRM suffix.

USE MSCRM_Config
DECLARE @NewOrgName VARCHAR(64)
SET @NewOrgName = 'DefenseReadyUM'

UPDATE [MSCRM_CONFIG].[dbo].[SystemUser] SET [DefaultOrganizationId] =
(SELECT [Id] FROM [MSCRM_CONFIG].[dbo].[Organization] WHERE [DatabaseName] = @NewOrgName + '_MSCRM')
WHERE EXISTS (SELECT [Id] FROM [MSCRM_CONFIG].[dbo].[Organization] WHERE [Id] = [MSCRM_CONFIG].[dbo].[SystemUser].[DefaultOrganizationId])

No comments: