I am trying to display a QMessage box when a sales order is opened from the Open Order List. I have the message displaying but am not able to find the cohead_id to include in my query. I have created this as salesOrder.js. I have tried referencing the _list object from openSalesOrder but the _list.id() is -1. Any ideas on how to find the cohead_id for the following script?
var _list = mywindow.findChild("_list");
var qry = toolbox.executeQuery("SELECT COALESCE(count(wavebatch_id),0) AS _onwave FROM _wms.wavebatch JOIN cohead ON wavebatch_sales_order_number = cohead_number WHERE cohead_id = "
var onwave = qry.first("_onwave");
if(onwave > 0)
QMessageBox.warning(mywindow, qsTr("WARNING"), "This Sales Order is on a WAVE and should not be updated without permission from the MSC.");