65
Views
3
Comments
The INSERT statement conflicted with the FOREIGN KEY constraint
Question
Application Type
Reactive

Hi,


I have ran into a message whereby shown below where by I can't save my details in the Group Entity, since Group (is under a System User API) I'm not allowed to make any changes on that entity, I've created an extension entity called 'Group2Ext' and set the ID as Group Identifier. Could you please advice how I could workaround with this? Attached here with the OML file, referring to the Manager/Group Detail Screen


The INSERT statement conflicted with the FOREIGN KEY constraint "OSFRK_OSUSR_UNR_GROUPLINE_OSSYS_GROUP_ID". The conflict occurred in database "MBW0CP018", table "dbo.OSSYS_GROUP", column 'ID'. The statement has been terminated. 


Regards,

Ming

LanceTime Q4.oml
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Ming,

The error message tells you that you try to insert (i.e. create) a new GroupLine record, which has a Group Identifier as mandatory foreign key, but the value supplied is not in the Group entity. Most likely, you do not set it and it's NullIdentifier().

So your error message has nothing to do with Group2Ext (unless that entity used to be called GroupLine and you renamed it, in which case the physical name stays the same and doesn't reflect the current logical name).

2025-11-20 08-47-27
Bheeshm Narayan singh

Hello @Ming Y .

As you mentioned above that  ( I've created an extension entity called 'Group2Ext' and set the ID as Group Identifier. )

In this case you are using ID as an Group identifier and its delete rule is set to PROTECT,

please change this to ignore or delete. your functionality will work properly. or you can add/insert or update or delete as you want..


Thanks

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

That's bad advice. By changing the Delete Rule, the code won't give an error, but the underlying problem is still there, and their code still won't work!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.