Update view from popup

I have a view that opens a popup window

the popup calls a controller method

in the controller it accesses the two contexts, main view context (SaleOrder) and popup context (SaleOrderLine)

SaleOrderLine saleOrderLine = request.getContext().asType(SaleOrderLine.class); //popup context
SaleOrder saleOrder = request.getContext().getParent().asType(SaleOrder.class); // context view parent

Sales order goes through some processing and then I want to return it to the view, and the view updates, but it doesn’t work

If I send the saleorderline data, if it updates
response.setValues(saleOrderLine); //work

If I send the sales data, the order does not update
response.setValues(saleOrder);//not working

What would be the way to update the data of the main view or the view that opens the popup with the salesOrder data?

Hello

We can specify onChange on Sale Order form to update the values on Sale Order according to the latest Sale order lines.

Another way to achieve this is , Save the Sale Order line and sale order & then reload the view.

Hope this hint will help you figure out your solution

Thank you

Hello, thanks for responding
I didn’t understand the first option you recommended.

I tried the second one but it didn’t work perfectly.

When selecting the customer, the sales order is saved, the SaleOrderLine related panel is also enabled, with the context button I send the SaleOrder id, in the controller I save the SaleOrderLine, but the problem is that when the view is reload and delete some saleOrderLine from the grid (in the related panel) the view is reloaded and again loads the saleOrderLine from the database to delete, the thing is that the saleOrderLine from the grid is deleted in memory, I don’t know the database, it would work Yes, it would also delete from the grid, but I didn’t like this option.

Hello

Specify one action on onChange on saleOrdeLineList field on SaleOrder form to set the value for SaleOrder. And the popup calls the controller method will only process and set the values for SaleOrderLine.

Thank you