Synchronization Error: Cannot insert duplicate key row in object 'dbo.ModulePermissions' with unique index 'IX_ModulePermissions_Rule'

Description

Synchronization may fail with the following error:

--- [HASH: 07BE0BC1031649F27D59FBA790CBA30E] ---
Synchronization failed
eWay.Core.Exceptions.StoreException: Synchronization of items in folder 'ModulePermissions' failed. ---> eWay.Core.Exceptions.StoreException: Cannot save an item with id '25f68083-2cf4-11e8-8d1f-a80ac8be052a' to table 'ModulePermissions' ---> eWay.Core.Exceptions.StoreException: Cannot save item with ID='25f68083-2cf4-11e8-8d1f-a80ac8be052a' to folder ModulePermissions. ---> System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object 'dbo.ModulePermissions' with unique index 'IX_ModulePermissions_Rule'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at eWay.Core.Data.SynchronizedSqlCommand.<>c__DisplayClass23_0.<ExecuteNonQuery>b__0() in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\eWayShared\Data\SynchronizedSqlCommand.cs:line 160
   at eWay.Core.Data.SqlCommandRepeater.RunSqlCommand(SqlCommand command, SqlCommandDelegate sqlCommand) in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\eWayShared\Data\SqlCommandRepeater.cs:line 77
   at eWay.Core.Data.SynchronizedSqlCommand.ExecuteNonQuery() in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\eWayShared\Data\SynchronizedSqlCommand.cs:line 158
   at eWay.Core.MSSQLDataInterface.MSSQLItemStore.SaveItemToDatabase(OutlookItem item) in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\MSSQLDataInterface\MSSQLItemStore.cs:line 2415
   --- End of inner exception stack trace ---
   at eWay.Core.MSSQLDataInterface.MSSQLItemStore.SaveItemToDatabase(OutlookItem item) in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\MSSQLDataInterface\MSSQLItemStore.cs:line 2422
   at eWay.Core.MSSQLDataInterface.MSSQLItemStore.SaveItem(OutlookItem item) in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\MSSQLDataInterface\MSSQLItemStore.cs:line 769
   --- End of inner exception stack trace ---
   at eWay.Core.MSSQLDataInterface.MSSQLItemStore.SaveItem(OutlookItem item) in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\MSSQLDataInterface\MSSQLItemStore.cs:line 773
   at eWay.Core.CachedDataInterface.CachedItemStore.SaveItemLocal(OutlookItem oldItem, OutlookItem itemToBeSaved, Nullable`1 serverItem) in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\CachedDataInterface\CachedItemStore.cs:line 2602
   at eWay.Core.CachedDataInterface.CachedItemStore.SaveRemoteItemToLocalStore(OutlookItem remoteItem, IOutlookApplication olApplication, Boolean& isNew) in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\CachedDataInterface\CachedItemStore.cs:line 1932
   at eWay.Core.CachedDataInterface.CachedItemStore.DownloadItems(IOutlookApplication application, SynchronizationItem synchronizationSetting, DateTime till, Boolean& newData) in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\CachedDataInterface\CachedItemStore.cs:line 1557
   --- End of inner exception stack trace ---
   at eWay.Core.CachedDataInterface.CachedItemStore.DownloadItems(IOutlookApplication application, SynchronizationItem synchronizationSetting, DateTime till, Boolean& newData) in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\CachedDataInterface\CachedItemStore.cs:line 1637
   at eWay.Core.Synchronization.SynchronizeThread.SynchronizeAll(IEnumerable`1 synchronizationItems, Boolean& synchronizationOK, Boolean& newData, DateTime till, Boolean disableConstraints) in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\eWaySynchronization\SynchronizeThread.cs:line 1354
   at eWay.Core.Synchronization.SynchronizeThread.Synchronize() in C:\CC.NET\Projects\NAnt\Sources\eWayLibrary\eWaySynchronization\SynchronizeThread.cs:line 522
--- END TRACE ---

Version

All versions of eWay-CRM

Difficulty

Medium

Resolution

You need to change value of Synchronized key in Windows Registry.

Go to this path in Windows Registry:

HKEY_CURRENT_USER\Software\Memos\eWay Outlook Client

There is Synchronized key that is needed to be set to 0. The same result can be done when you download this file: https://download.eway-crm.com/regfiles/Synchronized.zip. Unzip it on your computer and run it. Synchronized will be set to 0.

After that you have to restart Microsoft Outlook.