This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - SQL FOREIGN KEY constraint error

scottmahr - Friday, August 26, 2011 1:34 PM:

Hi,

I am working on a workflow where I add and remove assignments as the workflow progresses.  On the close of one activity, I run the AML 

<Item type='Activity Assignment' action='delete' "+

"id='"+myResult.getItemByIndex(i).getID()+"'>"+

"</Item></AML>

I do this for a couple assignees on an activity, then I add an assignee afterwards.  This seems to work fine, but then at some later point I get the following error.  

The UPDATE statement conflicted with the FOREIGN KEY constraint "FK__ACTIVITY___RELAT__54A177DD". The conflict occurred in database "InnovatorSolutions", table "innovator.IDENTITY", column 'ID'. The statement has been terminated. in SQL: UPDATE [ACTIVITY_ASSIGNMENT] SET [RELATED_ID] = @related_id,[PERMISSION_ID] = src.[PERMISSION_ID], [TEAM_ID] = src.[TEAM_ID] FROM ( SELECT [PERMISSION_ID], [TEAM_ID] FROM [ACTIVITY] WHERE [ID] = @srcId ) AS src WHERE [ID] = @id

I have no clue what is going on, thought I would see if anyone has seen this before.  Any pointers as to where to look for an issue would be helpful as well.

 

Thanks,

Scott



John Sharpe - Friday, April 17, 2015 5:09 PM:

Scott,

Did you ever figure this out?  I have a relatively simple ItemType, Workflow, and Life Cycle.  I removed all of the foreign data types, but when I try to save the record, I get a similar error message.

Anybody, referring to the item, "FK_ACTIVITY_RELAT_54A177DD," is there any way to look up 54A177DD to see what it is?

Thanks,

John