Add child items (Order Details) inserting new parent item (New Order)

2018-06-19 17:29:40

Sharepoint Online

I have two lists Orders and OrderDetails in parent/child relationship

The Order list has these fields:

1) Order Number

2) Order Date

....

The OrderDetails List has these fields:

1) ID

2) Order Number (LOOKUP field)

3) Item Name

4) Price

5) Quantity

.....

I would like to be able to insert the order and details in the same form and save. I'have edited the OOTB NewForm.aspx in the Ordes List adding the fields for the OrderDetails List.

Now I have to edit the save button (or maybe the save action) to insert data in the OrderDetails List after inserting the new item in the Orders List.

I've tried to search some samples but I did not find anything and I am very surprised because I think it is a fairly common requirement...

Can someone help me?

Thanks

Marco