CreateOrUpdate inserts when update was expected
Question
Application Type
Reactive

I call a createorupdatetable action. When I debug this I see that the "ID" of the source i specify is filled with an existing id in the table.

Still a insert is executed wich leads to an exception caused by a unique index.


I had the idea that specifying the ID of he table always leads to an update. 

Am i wrong? What else can I do to prevent this?


Hey Cees,

You are not wrong but it's possible that you've set an index on a different field that's causing the exception?

Can you go to your entity - entity detail and check your indexes and see what fields the index is set on?


Kind Regards,


Nick

Hello Cees, 

As Nick said you are right that if record has Id which is existing into table it will be update process. 

Also Nick suggested to check if table has any indexes. 

If you can share more details like exception message or sample application with this case so this will help to find solution

Hello,

Are your sure that you have used CreateOrUpdate<Entity> action only and not Create<Entity>? However, if you are sure that CreateOrUpdateEntity action is inserting a new record even when you are passing a ID, please open a support case with OutSystems to look into this issue. 

Also, please refer the below link to know more about this.

https://www.outsystems.com/forums/discussion/56793/entity-actions-documentation/

Thanks & Kind Regards,

Sachin


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