
[ExtensionOf(formControlStr(SalesTable, SalesLine_ItemId))]
final class SalesTableForm_ItemIdControl_???_Extension
{
public boolean modified()
{
boolean ret;
FormStringControl ctrl = this as FormStringControl;
ItemId itemId = ctrl.text();
InventTable inventTable;
if(itemId != '' && !InventTable::exist(itemId)) // ItemId has been entered but it is not valid InventTable Item
{
inventTable = InventTable::find(InventItemBarcode::findBarcode(itemId, False, False).itemId);
if (inventTable.ItemId != '') //Not an Item found with barcode
{
info(StrFmt("Barcode value entered. Item ID: %1.",inventtable.ItemId)); //Optional
ctrl.text(inventTable.ItemId); // Update the control with the correct Item Id
//WHEN DEBUGGING THE ctrl.text is ""
//How do I refresh the form ????????
}
}
ret = next modified();
return ret;
}
}