39
Views
10
Comments
Solved
Getting error while saving three entities from a single save button

Getting error while saving three entities from a single save button

Capture.PNG
2025-10-10 00-19-44
Bruno Rendeiro
Solution

hy @Priyanka Singh 

Why are you putting the personID on the Order.Id?


The id that you get from PersonCreateOrUpdate, is the person.id, you are trying create a new order in data base with the order.id = person.ID



And you have a lot of server action, in the same client action. Why don't you group all the server action in one?

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

The reason why you should group all server actions in your client action is for performance. Each server action in your client action gets translated by OutSystems by an API call to the OutSystems server. 

UserImage.jpg
Priyanka Singh

Thank you.

Now I can solve this problem

UserImage.jpg
Sameeksha Dwivedi
Solution

Hi @Priyanka Singh,

Since you have productId and orderDetailId in your order entity, you must assign both values before saving order entity.  Create product and orderdetail before creating order, then assign id values and create order.

Other than this order entity and order detail entity should have autonumber set to true. You cannot assign project id to orderId.

Hopefully this helps.

Regards,

Sameeksha Dwivedi

UserImage.jpg
Priyanka Singh

Thank you.

Now I can solve this problem

UserImage.jpg
vikas sharma
Champion

Hi,

What error you are getting ? Could you please provide screenshot or details of error.

regards

UserImage.jpg
Priyanka Singh

Only one entity is updated in the table.

The other 2 entities are not updated in the save button

Entity.oml
2023-08-28 07-00-10
Paulo Torres
Champion

Should be related with data integrity. Can you send the error from Service Center?

UserImage.jpg
Priyanka Singh

I  am new to outsystems,not sure how to access service center.

UserImage.jpg
vikas sharma
Champion

Hi Priyanka,

From where you are creating order and order details. I checked in both tables Id is not auto increment. So I have doubt when you get data by aggregate getPersonById, it have order id and order details id as 0. Now when you try to create the records with these values it gets failed.

As Paulo mentioned could you please provide service center screenshot for this error.

regards

2025-10-10 00-19-44
Bruno Rendeiro
Solution

hy @Priyanka Singh 

Why are you putting the personID on the Order.Id?


The id that you get from PersonCreateOrUpdate, is the person.id, you are trying create a new order in data base with the order.id = person.ID



And you have a lot of server action, in the same client action. Why don't you group all the server action in one?

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

The reason why you should group all server actions in your client action is for performance. Each server action in your client action gets translated by OutSystems by an API call to the OutSystems server. 

UserImage.jpg
Priyanka Singh

Thank you.

Now I can solve this problem

UserImage.jpg
Sameeksha Dwivedi
Solution

Hi @Priyanka Singh,

Since you have productId and orderDetailId in your order entity, you must assign both values before saving order entity.  Create product and orderdetail before creating order, then assign id values and create order.

Other than this order entity and order detail entity should have autonumber set to true. You cannot assign project id to orderId.

Hopefully this helps.

Regards,

Sameeksha Dwivedi

UserImage.jpg
Priyanka Singh

Thank you.

Now I can solve this problem

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