We are trying to programmatically add a line item via a button click script event in Sales Order Entry where the item code being entered has Bill Options enabled.
The canned Sage logic for Bill Option enabled items prompts the user to choose the bill options and then when you click OK, each bill option item is added as an individual line. When we try to do this programmatically, we are prompted to choose the bill options for the item code entered, however when we choose the bill options and click OK the bill option lines aren’t being exploded/added – essentially nothing happens.
The item we are adding programmatically is configured to Explode Kit Items = Always, and has a matching BOM with Bill Options.
Does anyone have experience doing something similar or have any idea on why the bill option lines are being exploded after we click OK to the canned Sage prompt?
Below is the code in our script that is called from a button on the Lines tab header section:
error_code = "" Set oLines = oBusObj.AsObject(oBusObj.Lines) error_code = oLines.AddLine() sLineKey = "" error_code = oLines.GetValue("LineKey$", sLineKey) sEditKey = oLines.GetEditKey(sLineKey) error_code = oLines.SetValue("ItemCode$","TEST_ITEM") error_code = oLines.SetValue("UDF_WORK_ORDER_ID", 1234) error_code = oLines.SetValue("ExplodedKitItem$", "Y") error_code = oLines.SetValue("SalesKitLineKey$", "000001") error_code = oLines.SetValue("Revision$", "000") error_code = oLines.Write() error_code = oLines.EditLine(sEditKey) oScript.LinesAdded = 1 error_code = oScript.LoadGrid("GD_Lines") error_code = oUIObj.HandleScriptUI()