The INSERT statement conflicted with the FOREIGN KEY constraint error: ToDo App

The INSERT statement conflicted with the FOREIGN KEY constraint "OSFRK_OSUSR_QN2_IT_REQUEST_TABLE3_OSUSR_QN2_STATUS3_STATUSID". The conflict occurred in database "XNRR7V010", table "dbo.OSUSR_QN2_STATUS3", column 'ID'.<br/>The statement has been terminated.

When testing the ToDo app on the webbrowser I cannot create a new ToDo, displaying that error.

Also, when I press the dropdown to select the Category, it's empty, with no categories to choose. 

Any help? 


Hello Pedro, welcome to the forum.

In the table you are trying to save a record, you have a FOREGN KEY column, called StatusId, that is mandatory (you HAVE to provide a valid value), but you are not providing (it is going with NullIdentifier() value), and thus, the database do not find it in the Status table, and raises the error.

Be sure to set the field StatusId with a valid value before trying to save the record.


Hi, thanks Eduardo

I'm sorry, but I really can't find the source of the problem. Where should I be looking for it? Can't find the StatusId, and thus, can't change to a valid value. and what would be the right value?

The strange thing is I'm following the courses provided by outsystems.. should i keep getting this error? 

And the ToDo app I'm using is provided in the source materials.


I'd say that "IT_REQUEST_TABLE" has a link to what is probably a static entity called "STATUS". That link is probably set to mandetory and either you are inserting a record without setting the STATUS or you are setting the STATUS to an invalid value. If you post a screen capture of your REQUEST_TABLE and STATUS entity structures we may be able to show you where the issue is.

Actually rereading your message and reply "Can't find the StatusId, and thus, can't change to a valid value. and what would be the right value?" I think that is exactly your problem. You aren't setting the status at all. If I'm guessing correctly you have a form that you are entering the REQUEST details, that form should have a STATUS combobox on it linking to the status field in IT_REQUEST_TABLE and taking its values from the STATUS entity. You probably either don't have that combobox or you haven't connected it up to the variable correctly. 

i dont have a coding background, im following outsystems guided paths to learn about it. surely that must be an handicap on my part.

where can i see my request table so i can send you a screenshot?

also, any tips on why the dropdown for categories is blank when it should be showing the various categories that i can assign to a ToDo (categories being groceries, movie to watch, travel, work, family, private)

EDIT: i noticed that rhe INSERT statement conflicted with the FOREIGN KEY constraint error started after style sheets exercise and that the dropdown being empty and blank started after the local storage exercise

The request table will be in the data tab (top right), under Entities/Database.

Yes the reason for the error will be because the category dropdown is blank so once you fix that then the error should go away. I sugest going back to the guided path to where you inserted the combobox and recheck, tip, check the fields highlighed on my screencapture with what they should be in the  quided path

Hi Pedro,

Please share sample eSpace so that we can have a look.

Thanks and Regards,

Suraj Borade

Hi Pedro Gomes da Silva,

Think this will be help full for you,

let me know if you need more clarification.


Manikandan K

Hello Pedro,

If I may, I would like to give you some advise.

OutSystems is a Low Code platform that helps creating applications much faster than with normal technologies (a.k.a., other programing languages).

But you are definitely programming in OutSystems. You need to know the basic programming concepts before trying out the online OutSystems guided paths, as they are meant to developers to get to know how to use the platform, not to teach programming.

Without this prior knowledge, your ability to do anything in OutSystems will be very limited.

I recommend you to do any of the introductory programming courses you can find online (in Coursera, specialized web sites, etc), and later maybe even a second step on learning about Web Programming (same places), before comming to OutSystems. 

You will improve much quicker this way.