When an order is already open in the standard Select window, we would like to also be able to open it (ideally grabbing the currently open order instance) in our custom form update and save, pushing the changes back to the currently open select window for the order.
Below was our attempt at getting the order if its open, otherwise calling the order store:
Code: Select all
IWindowManager windows = WindowManager.Windows.ToList();
foreach (var doc in windows)
{
var order = doc.GetProperty("Order") as IOrder;
if (order?.Guid == orderId)
return order;
}
return OrderStore.OpenOrder(new OrderIdentifier(orderId), OrderEditMode.ReadWrite);
How ever this through various errors for us occuring on var order = doc.GetProperty("Order") as IOrder;:
1. occasionally get an error telling us to install GdPicture.NET Package.
2. a JIT caught exception saying the enumeration has been modified.
Neither of this errors make any sense based on the code above.
We would like to know how to retrieve an open order (that may or may not be open) from another window without redirecting the user to the order window.