Sage 100 Standard 2015
I have this script in Sales Order. We have a custom panel with some Header UDF's and when the user selects a line, it copies the LineKey into a header UDF to be retrieved by this script to update the Line with new UDF values. It works great if you save a Sales Order, then edit a line. But when creating a new Sales Order that has not yet been saved, the GetEditKey method does not appear to work. Is there a different method I should use for a new Sales Order?
sEditKey = oLines.GetEditKey(sLineKey) 'returns a full EditKey value when editing a line in a sales order that has already been saved
msgbox "linekey: " & sLinekey & " editkey: " & sEditKey 'sLineKey returns the correct value, sEditKey returns 0
retVal = oLines.EditLine(sEditKey) 'retVal = 2 and creates a new line instead of editing the existing line
'retval = oLines.EditLine(sLineKey & sLineSeq) 'my attempt to bypass the GetEditKey method, same results, both variables have correct values
msgbox retval
retVal = oLines.SetValue("ItemCode$", sItemCode)
If retVal = 1 Then
retVal = oLines.SetValue("ItemCodeDesc$", sDescription)
retVal = oLines.SetValue("UDF_LINE_COLOR$", sColor)
retVal = oLines.SetValue("UDF_LINE_STRAP_SPACE$", sStrap)
retVal = oLines.SetValue("UDF_LINE_OVERLAP$", sOverlap)
retVal = oLines.SetValue("UDF_LINE_PRICE_PER_SQ_FT", nUnitPrice)
retVal = oLines.SetValue("UDF_LINE_TOT_MAT_PRICE", nTotalPrice)
retVal = oLines.SetValue("UDF_LINE_FIT_TYPE$", sFit)
retVal = oLines.SetValue("UDF_LINE_FOLD_TYPE$", sFold)
retVal = oLines.SetValue("UDF_LINE_MATERIAL$", sMaterial)
retVal = oLines.SetValue("UDF_LINE_OPTION1$", sOption1)
retVal = oLines.SetValue("UDF_LINE_OPTION1_QTY", nOption1Qty)
retVal = oLines.SetValue("UDF_LINE_OPTION1_NOTES$", sOption1Notes)
retVal = oLines.Write()
Elliott, are you there? :)
Thanks, Hollie