Error and Solution: The INSERT statement conflicted with the FOREIGN KEY constraint

Posted By Posted by: Peter Williams on April 13, 2015

We recently received an issue where our client was unable to see a project in their Project Status Report. They had tried publishing the project and received a “Failed But Not Blocking Correlation”. The error below was found in the project server queue:

ReportingProjectChangeMessageFailed (24006) – The INSERT statement conflicted with the FOREIGN KEY constraint “FK_MSP_EpmAssignmentByDay_ProjectUID_AssignmentUID”. The conflict occurred in database “P13_CLIENT_ProjectServer”, table “dbo.MSP_EpmAssignment”. The statement has been terminated.. Details: id=’24006′ name=’ReportingProjectChangeMessageFailed’ uid=’a13f6341-9eb1-e411-80ea-000d3ad00f0e’ QueueMessageBody=’Project UID=’dd8c29a2-c9ce-e311-942b-00155d10040a’. PublishType=’All” Error=’The INSERT statement conflicted with the FOREIGN KEY constraint “FK_MSP_EpmAssignmentByDay_ProjectUID_AssignmentUID”. The conflict occurred in database “P13_CLIENT_ProjectServer”, table “dbo.MSP_EpmAssignment”. The statement has been terminated.’. 

Part of the issue, was in fact, due to the Enterprise Project Type UID for the project being null.

In order to resolve, the following steps were undertaken:

  1. Backup project in SharePoint Central Admin
  2. Delete the Published version of the project via PWA Settings >> Delete Enterprise Objects
  3. Open project in MS Project Pro
  4. Save the schedule locally – File >> Share >>Save for Sharing but don’t close the file
  5. Save the project back to Project Server – File >> Save As >> Save. You will find the dialog prefilled with the information from the server
  6. Publish the project
    Note: When publishing the project it required me to create a new project site. The default name was already in use, so I created a site with a different name. After the successful publish, I relinked the project to the original project site via PWA Settings >> Connected SharePoint Sites
  7. Close MS Project Pro and check in project
  8. Reopen the project and republish as a double check
We hope you find this a helpful fix if you come across this issue.

Blog Posted In 

Leave a Reply

Your email address will not be published.