You are here: Home / FAQ / Database / Synchronization error during project erasing FK_EWD_TeamRoles_EWD_RelationData

Synchronization error during project erasing FK_EWD_TeamRoles_EWD_RelationData

Description

The error can happen if the eWay-CRM is in the offline mode on one PC and the project is erased on this PC. But a new team member was added to the project on other PC in the online mode by other user. After switching into the online mode, your system is trying to erase the project, but there is a conflict with reference integrity FK_EWD_TeamRoles_EWD_RelationData.

eWay Agent reports an synchronization error and in the local log is:

Synchronization failed
eWay.Core.DataInterface.StoreException: Uploading of items failed.
---> eWay.Core.DataInterface.StoreException: Cannot delete items in folder Projects.
---> eWay.Core.WebService.eWayWebServiceException: Web service returned an error (rcGeneralError):
The DELETE statement conflicted with the REFERENCE constraint "FK_EWD_TeamRoles_EWD_RelationData".
The conflict occurred in database "eWay", table "dbo.EWD_TeamRoles", column 'RelationDataGUID'.

The server log displays:

Removing item 'b33fe309-3e6e-11e4-8adf-c48508292a51' from folder 'RelationData'
Executing procedure: eWaySP_DeleteItem
Request processed with error response 'rcGeneralError'
System.Data.SqlClient.SqlException: The DELETE statement conflicted with the REFERENCE constraint "FK_EWD_TeamRoles_EWD_RelationData".
The conflict occurred in database "eWay", table "dbo.EWD_TeamRoles", column 'RelationDataGUID'.
The statement has been terminated.
at eWayWSImpala.ItemManager.RemoveItem(Guid itemGuid)
at eWayWSImpala.ItemManager.RemoveItems(IEnumerable`1 items)
at eWayWSImpala.eWayWS.RemoveItems(Guid SID, String ItemType, String[] Items)

Version

All versions of eWay-CRM

Difficulty

High

Resolution

In the server log, two rows above the logged error, there is also a record of a specific item that should be erased (the first row in the server log above). There is an ItemGUID in the report, so you can erase it manually on the basis of this ItemGUID.

Firstly, you need to find out the TeamRoles type items that relate to RelationDataGUID that should be erased:

SELECT * FROM EWD_TeamRoles WHERE RelationDataGUID = 'b33fe309-3e6e-11e4-8adf-c48508292a51'

Then, you need to erase these TeamRoles:

EXEC eWaySP_DeleteItem @ItemGUID = 'B33FE30A-3E6E-11E4-8ADF-C48508292A51', @ItemFolderName = 'TeamRoles'
EXEC eWaySP_DeleteItem @ItemGUID = 'B33FE30B-3E6E-11E4-8ADF-C48508292A51', @ItemFolderName = 'TeamRoles'
EXEC eWaySP_DeleteItem @ItemGUID = 'B33FE30C-3E6E-11E4-8ADF-C48508292A51', @ItemFolderName = 'TeamRoles'

The whole procedure should be provided by the eWaySP_Projects_RemoveRelatedItems trigger, but it won't work correctly with this error. New versions of eWay-CRM won't perform this error.