Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Dynamics 365 on-premise Problem update DB version when installation KB4046795, and Error when creating new entity

(0) ShareShare
ReportReport
Posted on by 91

Hi All,

Our CRM has 2 problems, first one, we can add a new field but we have error when creating a new entity: (Generic SQL Exception)

Crm Exception: Message: Generic SQL error., ErrorCode: -2147204784, InnerException: System.Data.SqlClient.SqlException (0x80131904): Must declare the scalar variable "@IsRoleDeleted".
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command, Boolean isReader)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteReader(IDbCommand command, Boolean capturePerfTrace, Boolean isReader)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.ExecuteQuery(CrmDbConnection dbConnection, IDbCommand command, ISqlExecutionContext context, Nullable`1 commandTimeout)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipalsInDb(Guid roleId, List`1 readPrivileges, Int32 countReadPrivileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipals(Guid roleId, RolePrivilege[] privileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.AddNewPrivilegesToExistingRole(Guid roleId, RolePrivilege[] privileges, ExecutionContext context)
   at Microsoft.Crm.Metadata.SecurityHelper.AddPrivilegesToUserRole(RolePrivilege[] privileges, Guid[] roleTemplates, ExecutionContext context)
   at Microsoft.Crm.Metadata.SecurityHelper.CreateEntityHelper(IEntityDescription entityDescription, OwnershipTypes ownershipTypeMask, ExecutionContext context)
   at Microsoft.Crm.Metadata.EntityService.CreateInternal(EntityCreateInfo entityInfo, MetadataHelper metadataHelper, ExecutionContext context)
   at Microsoft.Crm.Metadata.EntityService.Create(EntityCreateInfo entityInfo, MetadataHelper metadataHelper, ExecutionContext context)
   at Microsoft.Crm.Metadata.EntityService.Create(EntityCreateInfo entityInfo, ExecutionContext context)
   at Microsoft.Crm.Metadata.EntityService.Create(EntityCreateInfo entityInfo, Guid solutionId)
   at Microsoft.Crm.Application.WebServices.SystemCustomization.EntityCreate.Execute(Guid solutionId, ParameterBag paramBag)
   at Microsoft.Crm.Application.WebServices.SystemCustomization.SystemCustomization.CreateEntity(XmlNode data)
ClientConnectionId:3e89970a-4706-4663-898f-584d4a5de4da
Error Number:137,State:2,Class:15
[2018-06-12 18:48:53.919] Process: w3wp |Organization:e8f338d1-b2d1-49c7-a709-bf5981f91fa8 |Thread:   71 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 2a65245f-cea1-4746-9235-f745db8ef1ae |ActivityId: 2a65245f-cea1-4746-9235-f745db8ef1ae | AppWebService.CreateSoapException  ilOffset = 0x4F
>MSCRM Error Report:
--------------------------------------------------------------------------------------------------------
Error: Must declare the scalar variable "@IsRoleDeleted".

Error Number: 0x80044150

Error Message: Generic SQL error.

Error Details: Generic SQL error.

Source File: Not available

Line Number: Not available

second one, we found that we have installed the KB , but in deployment manager, the org version stay in  8.2.1.176(CRM is 8.2.2.112 ), so we retried to update the organization but has error message as following:

19:39:29|   Info| Applying latest dbUpdates to organization.  Id=a9d4208e-8164-e811-b815-00505681f32c, UniqueName=.
19:39:54|Verbose| Organization a9d4208e-8164-e811-b815-00505681f32c does not have any custom activities
19:40:35|  Error| Failed in perform Action Upgrade of Solution=ActivityFeedsCore, FileName=ActivityFeeds_Managed.zip, Version=8.2.2.112, Action=Upgrade for OrgId= a9d4208e-8164-e811-b815-00505681f32c
19:40:35|   Info| CrmAction execution time; InstallDatabaseUpdatesAction; 00:01:06.6936167
19:40:35|  Error| Installer Complete: OrganizationDatabaseHotFixer - Error encountered
19:40:35|  Error| Exception occured during Microsoft.Crm.Tools.Admin.OrganizationDatabaseHotFixer: Error.ActionFailed Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction
InnerException:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Crm.Tools.ImportExportPublish.ImportGenericException: Import failed-   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command, Boolean isReader)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteReader(IDbCommand command, Boolean capturePerfTrace, Boolean isReader)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.ExecuteQuery(CrmDbConnection dbConnection, IDbCommand command, ISqlExecutionContext context, Nullable`1 commandTimeout)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipalsInDb(Guid roleId, List`1 readPrivileges, Int32 countReadPrivileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipals(Guid roleId, RolePrivilege[] privileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.AddPrivilegesInternal(Guid roleId, RolePrivilege[] privileges, Boolean replace, Boolean import, ExecutionContext context, Boolean ignoreSharepointRPForBPFEntity)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.ReplacePrivilegesInternal(Guid roleId, RolePrivilege[] privileges, Boolean import, ExecutionContext context, Boolean replace, Boolean ignoreSharepointPriv)
   at Microsoft.Crm.Tools.ImportExportPublish.ImportSecurityRoleHandler.ImportItem()
   at Microsoft.Crm.Tools.ImportExportPublish.ImportHandler.Import()
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.ImportAndUpdateProgress(ImportHandler ih)
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.ProcessNonMetadataHandlers(String[] ImportEntities, ImportHandler& ihForCurrentPath, CounterList listCounters)
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.RunImport(String[] ImportEntities) ---> System.Data.SqlClient.SqlException: Must declare the scalar variable "@IsRoleDeleted".
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command, Boolean isReader)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteReader(IDbCommand command, Boolean capturePerfTrace, Boolean isReader)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.ExecuteQuery(CrmDbConnection dbConnection, IDbCommand command, ISqlExecutionContext context, Nullable`1 commandTimeout)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipalsInDb(Guid roleId, List`1 readPrivileges, Int32 countReadPrivileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipals(Guid roleId, RolePrivilege[] privileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.AddPrivilegesInternal(Guid roleId, RolePrivilege[] privileges, Boolean replace, Boolean import, ExecutionContext context, Boolean ignoreSharepointRPForBPFEntity)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.ReplacePrivilegesInternal(Guid roleId, RolePrivilege[] privileges, Boolean import, ExecutionContext context, Boolean replace, Boolean ignoreSharepointPriv)
   at Microsoft.Crm.Tools.ImportExportPublish.ImportSecurityRoleHandler.ImportItem()
   at Microsoft.Crm.Tools.ImportExportPublish.ImportHandler.Import()
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.ImportAndUpdateProgress(ImportHandler ih)
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.ProcessNonMetadataHandlers(String[] ImportEntities, ImportHandler& ihForCurrentPath, CounterList listCounters)
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.RunImport(String[] ImportEntities)
   --- End of inner exception stack trace ---
   at Microsoft.Crm.Tools.ImportExportPublish.ImportXml.RunImport(String[] ImportEntities)
   at Microsoft.Crm.Tools.ImportExportPublish.ImportXml.RunImport()
   at Microsoft.Crm.SE.DllMethodActions.ImportCustomSolution.UpdateSolution(String targetVersion, String solutionUniqueName, Nullable`1 solutionId, String currentSolutionVersion, String solutionFileName, Byte[] solutionBytes, Int32 organizationLanguageCode, SolutionOpertationType currentSolutionAction)
   at Microsoft.Crm.SE.DllMethodActions.ImportCustomSolution.Execute(String targetVersion, String solutionUniqueName, String currentSolutionVersion, String solutionFileName, String sku, String solutionOperation)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at Microsoft.Crm.Setup.Database.DllMethodAction.Execute(Guid organizationId, Nullable`1 operationType)
   at Microsoft.Crm.Setup.Database.DatabaseInstaller.ExecuteReleases(ReleaseInfo releaseInfo, Boolean isInstall)
   at Microsoft.Crm.Setup.Database.DatabaseInstaller.Install(Int32 languageCode, String configurationFilePath, Boolean upgradeDatabase, Boolean isInstall)
   at Microsoft.Crm.Setup.Database.DatabaseInstaller.InstallUpdate(String configurationFilePath, Boolean upgradeDatabase)
   at Microsoft.Crm.Setup.Common.Update.DBUpdateDatabaseInstaller.ApplyDBUpdates(Guid orgId, Nullable`1 operationType)
   at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.ApplyDBUpdatesInternal(Guid orgId, String orgUniqueName, String releaseFilePath, Boolean ignoreErrors, OrganizationOperationType operationType)
   at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.ApplyDBUpdates(Guid orgId, String orgUniqueName, OrganizationOperationType operationType)
   at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.Do(IDictionary parameters)
   at Microsoft.Crm.Setup.Shared.CrmAction.ExecuteAction(CrmAction action, IDictionary parameters, Boolean undo)
InnerException:
Microsoft.Crm.Tools.ImportExportPublish.ImportGenericException: Import failed-   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command, Boolean isReader)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteReader(IDbCommand command, Boolean capturePerfTrace, Boolean isReader)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.ExecuteQuery(CrmDbConnection dbConnection, IDbCommand command, ISqlExecutionContext context, Nullable`1 commandTimeout)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipalsInDb(Guid roleId, List`1 readPrivileges, Int32 countReadPrivileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipals(Guid roleId, RolePrivilege[] privileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.AddPrivilegesInternal(Guid roleId, RolePrivilege[] privileges, Boolean replace, Boolean import, ExecutionContext context, Boolean ignoreSharepointRPForBPFEntity)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.ReplacePrivilegesInternal(Guid roleId, RolePrivilege[] privileges, Boolean import, ExecutionContext context, Boolean replace, Boolean ignoreSharepointPriv)
   at Microsoft.Crm.Tools.ImportExportPublish.ImportSecurityRoleHandler.ImportItem()
   at Microsoft.Crm.Tools.ImportExportPublish.ImportHandler.Import()
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.ImportAndUpdateProgress(ImportHandler ih)
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.ProcessNonMetadataHandlers(String[] ImportEntities, ImportHandler& ihForCurrentPath, CounterList listCounters)
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.RunImport(String[] ImportEntities) ---> System.Data.SqlClient.SqlException: Must declare the scalar variable "@IsRoleDeleted".
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command, Boolean isReader)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteReader(IDbCommand command, Boolean capturePerfTrace, Boolean isReader)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.ExecuteQuery(CrmDbConnection dbConnection, IDbCommand command, ISqlExecutionContext context, Nullable`1 commandTimeout)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipalsInDb(Guid roleId, List`1 readPrivileges, Int32 countReadPrivileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipals(Guid roleId, RolePrivilege[] privileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.AddPrivilegesInternal(Guid roleId, RolePrivilege[] privileges, Boolean replace, Boolean import, ExecutionContext context, Boolean ignoreSharepointRPForBPFEntity)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.ReplacePrivilegesInternal(Guid roleId, RolePrivilege[] privileges, Boolean import, ExecutionContext context, Boolean replace, Boolean ignoreSharepointPriv)
   at Microsoft.Crm.Tools.ImportExportPublish.ImportSecurityRoleHandler.ImportItem()
   at Microsoft.Crm.Tools.ImportExportPublish.ImportHandler.Import()
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.ImportAndUpdateProgress(ImportHandler ih)
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.ProcessNonMetadataHandlers(String[] ImportEntities, ImportHandler& ihForCurrentPath, CounterList listCounters)
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.RunImport(String[] ImportEntities)
   --- End of inner exception stack trace ---
   at Microsoft.Crm.Tools.ImportExportPublish.ImportXml.RunImport(String[] ImportEntities)
   at Microsoft.Crm.Tools.ImportExportPublish.ImportXml.RunImport()
   at Microsoft.Crm.SE.DllMethodActions.ImportCustomSolution.UpdateSolution(String targetVersion, String solutionUniqueName, Nullable`1 solutionId, String currentSolutionVersion, String solutionFileName, Byte[] solutionBytes, Int32 organizationLanguageCode, SolutionOpertationType currentSolutionAction)
   at Microsoft.Crm.SE.DllMethodActions.ImportCustomSolution.Execute(String targetVersion, String solutionUniqueName, String currentSolutionVersion, String solutionFileName, String sku, String solutionOperation)
InnerException:
System.Data.SqlClient.SqlException (0x80131904): Must declare the scalar variable "@IsRoleDeleted".
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command, Boolean isReader)
   at Microsoft.Crm.CrmDbConnection.InternalExecuteReader(IDbCommand command, Boolean capturePerfTrace, Boolean isReader)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.ExecuteQuery(CrmDbConnection dbConnection, IDbCommand command, ISqlExecutionContext context, Nullable`1 commandTimeout)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipalsInDb(Guid roleId, List`1 readPrivileges, Int32 countReadPrivileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipals(Guid roleId, RolePrivilege[] privileges, Boolean isRoleDeleted, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.AddPrivilegesInternal(Guid roleId, RolePrivilege[] privileges, Boolean replace, Boolean import, ExecutionContext context, Boolean ignoreSharepointRPForBPFEntity)
   at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.ReplacePrivilegesInternal(Guid roleId, RolePrivilege[] privileges, Boolean import, ExecutionContext context, Boolean replace, Boolean ignoreSharepointPriv)
   at Microsoft.Crm.Tools.ImportExportPublish.ImportSecurityRoleHandler.ImportItem()
   at Microsoft.Crm.Tools.ImportExportPublish.ImportHandler.Import()
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.ImportAndUpdateProgress(ImportHandler ih)
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.ProcessNonMetadataHandlers(String[] ImportEntities, ImportHandler& ihForCurrentPath, CounterList listCounters)
   at Microsoft.Crm.Tools.ImportExportPublish.RootImportHandler.RunImport(String[] ImportEntities)
ClientConnectionId:09b08662-adbe-45f4-bdd8-5fc84199e842

Thanks

Song

*This post is locked for comments

  • Song Profile Picture
    Song 91 on at
    RE: Dynamics 365 on-premise Problem update DB version when installation KB4046795, and Error when creating new entity

    Hi, thank u for the information. finally, we reinstalled the CRM completely........

    Best regards

  • Suggested answer
    Atilla Profile Picture
    Atilla 145 on at
    RE: Dynamics 365 on-premise Problem update DB version when installation KB4046795, and Error when creating new entity

    Hello Song, A few weeks ago I had some issue on Dynamics 365 online because of the difference between db and organization, then opened a ticket and support team performed an upgrade then solved the problem. May be you should open a ticket to microsoft.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,313 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans