Getting error when deleting a record.

Getting error when deleting a record.

  

I'm getting an error when deleting a record. But i'm also not getting a confirmation message when deleting a record.

Solution

Hi Gambit,

The error message tells you that you tried deleting a PRODUCT record, but that there's a "REFERENCE constraint", which means that the specific PRODUCT you want to delete is referenced in another Entity and the Delete rule is set to "Protect". That other Entity is the CHANGES Entity, which references the PRODUCT by the PRODUCTID Attribute (or "column"). So there's a CHANGES record that has the Id of the PRODUCT you're trying to delete, and therefore you get an error.

As for your second remark about a "confirmation message", I'm not sure I understand what you mean by that.

Solution

If you delete a parent record, then you should also delete the child record, else you will see this exception.

Since ProductID is also present in Changes table, if you delete any product from Product table, you should also delete corresponding Productids from Changes table.

Hi Gambit Play,

Check if your delete rule of the referential attribute is set to Protect and change it (if it make sense)


https://success.outsystems.com/Documentation/10/Developing_an_Application/Use_Data/Data_Modeling/Entity_Relationships/Delete_Rules

Kilian Hekhuis wrote:

Hi Gambit,

The error message tells you that you tried deleting a PRODUCT record, but that there's a "REFERENCE constraint", which means that the specific PRODUCT you want to delete is referenced in another Entity and the Delete rule is set to "Protect". That other Entity is the CHANGES Entity, which references the PRODUCT by the PRODUCTID Attribute (or "column"). So there's a CHANGES record that has the Id of the PRODUCT you're trying to delete, and therefore you get an error.

As for your second remark about a "confirmation message", I'm not sure I understand what you mean by that.

Hi Kilian,


At first I was getting a prompt asking if i was sure to delete the record after I clicked the delete button. How do I create a message asking "Are u sure that you want to delete?" ?

Thank you for your time


Hi Gambit,

In links and buttons you have a property called "confirmation message". You can put that message you want there and you will me prompt before running the action linked to the button.

Regards,

Marcelo

Marcelo Ferreira wrote:

Hi Gambit,

In links and buttons you have a property called "confirmation message". You can put that message you want there and you will me prompt before running the action linked to the button.

Regards,

Marcelo

Thank you Marcelo.