The attached eSpace is being designed for my pre-school.

I have students (Ogrenci) and some detail entities about them.

Every Ogrenci has only one Pedagog record and evey Pedagog record belongs to only one Ogrenci, so I tried to design the foreign key constraint to be one to one relation by arranging PedagogId as Ogrenci Identifier.

There are some other similar detail entities like GenelDurum, AnneSagligi and all of them have the same problem that I am trying to explain now.

In the OgrenciShow webpage, I have a tabbed design for these details.

Every detail has links in If container at the top for adding a new record or editing the existing record.

Editing the existing records works very well.

But when I try to add a new detail record (for example "Pedagog Kaydi Ekle" Link), after clicking the "Kaydet" (i.e. Save) button, I receive an error as:

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

Any suggestions?

Thanks in advance.



EDIT: I have only corrected some small syntax errors in the message.

Hi Rifat,

Looking at the eSpace my suspicion is that the assignment just before the CreateOrUpdatePedagog node inside the Pedagog_PopupEditor>Save is wrong. I assume you probably want it to read

Variable 1: PedagogEdit.Record.Pedagog.Id
Value 1: PedagogId

As it is, I assume CreateOrUpdate is being called with Id=nullidentifier on a new record, which is hitting the constraint for Ogrenci.

Let me know if this helped,

Hi Miguel,

It really worked.

Thanks for your help, thanks for the explanation.

Kind Regards,

I also am getting the same error. I have been trying to figure out all day how to fix it, but nothing has worked yet.

This is the exact error:

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

I've attached the eSpace. I apologize if it's confusing ... Before using the Agile Platform I was a web designer, not a developer, so I may not be using the best methods for some things. Plus I've been awake for about 36 hours now working on this so it's probably something obvious and I'm just too tired to notice. ;)

I really appreciate any help! I'm completely stuck and of course this is supposed to go live tomorrow.

EDIT: Of course, being tired, I forgot to say where it was happening .... In the Main Flow, on the EnterInfo screen, after submitting the form (the "Next" action) I get the error.
Hi Britni...

The reason it's happening only for citizens outside Canada :) And why? Because you're most probably not assigning a country value (which is mandatory) when creating a Customer.

CustomerEdit.Record must have the country filled.

Have a nice Live ;)

The country is already assigned in the preparation based on the country they select in the Home screen. If the country is changed, the country is reassigned.

They also can get there from clicking "Edit" on the review page, in which case the country is also already assigned.
Hi Britni,

I didn't look too deeply into your eSpace but the AssignCountry node in the preparation looks suspicious: you're assigning directly to the Edit Record widget's country but at the end of the Preparation, when the screen gets data-bound, your Edit Record will grab the GetCustomerById.List.Current again (as per the Source Record prop) and ovewrite this assign.

Please have a second look at what you really wanted to do here.


If it is a new record, then I assign a default country in AssignCountry. If they are editing a record, then the country in GetCustomerById.List.Current overrides the default country.

I haven't had an problems at all with it not saving/displaying correctly. Nothing strange is happening to the data. I just keep getting the error. If this were just for internal use at my company, I wouldn't worry about it because you can just ignore the error and keep going without any problems. But there are going to be hundreds of customers using this that will panic when they see that error.
Hi Britni,
On the Preparation for EnterInfo screen, on the “AssignCountry” you should assing the countryid to “GetCustomerById.List.Current.CUSTOMER.Country”

(Reason: The “GetCustomerById.List.Current.CUSTOMER.Country” is the entity that will be used on the Edit Record. If you set the countryid directly to the “CustomerEdit.Record.CUSTOMER.Country”, after preparation it is overwrited)

Let me know if this solves your problem.


Márcio Spínola
Hi Britini,

Notice that you are also using the variable CustomerEdit.Record.CUSTOMER.Country in the assign and the edit record is not filled yet... it will have values only in the end of the preparation...

Carlos Rocha
I tried everything everyone suggested and nothing was working, so this is what I did...

The EnterInfo screen is no longer used as both a CREATE and EDIT screen. It is for creating only. Now, if customers need to edit their information, it takes them to a completely different page (in a popup). So it doesn't really solve the original problem technically, but at least now I don't have to worry about the error.

Thanks for the suggestions though everyone!


I'm very new to the OutSystems platform and trying to learn development by walking thru the online courses and sample apps. I was trying to build that ToDo app which was guided thru the course and when I'm trying to save a new ToDo item, I am receiving the same error. Hopefuly I have attached the correct file here. As far as I have figured out, the problem is lying inside the action of the SAVE button in the ToDo Details form but couldn't be able to figure out where the problem might be. Any help is higly appreciated. Thanks.

Hello Levent,

in order for us to better understand what is happening, can you share with us a screenshot of the error that you're receiving? If possible send a screenshot from the service center too.


Hello David,

Thanks for your prompt reply. Screenshot is attached as per your request.


Hello Levent,

What it looks like is that you're missing a sync with the Category Entity, because the dropdown it's empty on your screen.

Since the Category is a mandatory Id, when you try to create that record without the Id it returns that error.

Best Regards.

Hi David,

I have realized that the Category dropdown is empty but I'm a newbie and have no idea where and how to check or correct the mistake. I have discovered that the issue is with the Category entity and assigned a default value, re-published the app but still receiving the same error. Any insights are highly appreciated.


Hey Levent,

I understand that. 

Can you check if you have any data in the Entity Category on the ToDo_Core?

You can do this by right-clicking in the Entity and select View Data.


Hi people.

Please, don't resurrect posts from 2011.

Start a new thread.
Thank you.

Eduardo Jauch

can someone help im getting this error and i dont know why?

Hi Siyabonga Majola,

the previous reply in this thread already stated to create a new post instead of necro-threading this one.

so please do, thnak you very much.

Eduardo Jauch wrote:

Hi people.

Please, don't resurrect posts from 2011.

Start a new thread.
Thank you.

Eduardo Jauch