Adding a Bill Options enabled item programmatically, bill options lines are not being exploded/added


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()

  • 0

    When I import sales orders via Visual Integrator with Bills of Material with Options, I import L.BillOption1 to 9 for each line item.  In the import job, I set a lot of the header data then add in LineKey, ItemCode, QuantityOrdered and then all the bill options.  Some of these might be blank.  

    It seems to me that if you replicate a Visual Integrator job that works in your script, you should have all the required fields defined plus any other info you want to put in the Sales Order. 

    I can send you a copy of our job or screenshots is you want.