71
Views
8
Comments
Solved
CreateOrUpdate Entity Action error or exception
Question
Application Type
Reactive

Dear Community, 

In which cases will cause errors or exceptions when using the CreateOrUpdate Entity action and  how can I catch these errors or exceptions?

Thanks

2020-07-21 19-28-50
Rajat Agrawal
Champion
Solution

Hi,

You can catch error by using exception handling inside your action.

Below link is for your reference:

https://success.outsystems.com/documentation/11/building_apps/handling_exceptions/

There is many ways to come exceptions when using the CreateOrUpdate Entity action:

1. Sometime some values are null.

2. Id not generating and many more with using exception you can get proper error why error is coming in that action.

Need any help you can share error screenshot so we will clear more on that. Thanks!!!


Regards,

Rajat

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi ndy,

Note that in most cases, you do not want to use CreateOrUpdate, as it is slower than a single Create or a single Update (since the database must test whether the record exists first). So if you already know the record exists, use Update, otherwise use Create. A typical entity save wrapper does something like this:


2024-07-31 11-32-34
ndy

Your answer is helpful. Thanks. Can I have your demo file, @Kilian Hekhuis ?

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Sure, here you go. I'd appreciate it if you mark my answer above also as Solution, thanks!

CrudExample_CS.oml
2024-07-31 11-32-34
ndy

Can I know the data recording time on Service Center, @Kilian Hekhuis ? 

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
2024-07-31 11-32-34
ndy

Just like we can see the query time of a aggregate in Service Center. Can we see the data write time?

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

You cannot, as far as I known. But also be aware that the "Duration" column shows increments of about 15ms, so it isn't very precise.

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