Purchase Management

When I try to add new purchase i get the following message.

The INSERT statement conflicted with the FOREIGN KEY constraint "OSFRK_OSUSR_2xi_ShippingDetails_OSUSR_2XI_PURCHASE_ID". The conflict occurred in database "outsystems", table "dbo.OSUSR_2XI_PURCHASE", column 'ID'.
Hi Chip,

Can you give us a little bit of context? Are you using one of our applications? Are getting the error using your data? 
This error means you are you are trying to add data to an entity (ShippingDetails), but you have a foreign key to another entity (PURCHASE) with invalid data. For eg. if you have an attribute in ShippingDetails that is mandatory, and you don't set it's value you'll have this pattern, or if you add a value that doesn't exist in the table you'll have the same problem.

Putting it short, the value that you insert in the purchase_id must exist in the purchase table.

Did I help?

It seems that Chip was watching one of the videos at the academy, and when he tried to replicate the application in his own Service Studio, he got stuck with a little bug.

This error comes directly from the database, and when you are starting with the platform, these errors are very confusing.

If you translate the message in "human readable format :D" it says:
"You have tried to insert something in the table ShippingDetails, but in video  28-Create and Display a one-to-one relationship at 0:59s you changed the primary key of the ShippingDetails to reference the Purchase table. So when you insert something in the ShippingDetails, please ensure that it already exists on the Purchase table, otherwise I will throw a database error and prevent you from creating a shipping detail that isn't associated with any purchase ".

This also means that you cannot delete a purchase, if it has a purchase details associated. You'll need to first delete its associated purchase detail, so that you can then delete or the purchase.

So I cannot be 100% sure of where your error is, but I bet that if you review video 28-Create and display a one-to-one relationship, at 4:30, I think you'll be able to pinpoint were the error really is.
Even doing a good time to ask if it is useful for someone who has the same problem, check the "Source" selected in CreatePurchasedProduct action. 
Should be selected PurchaseProductEdit.Record.