I'm stuck and can't quite figure out why. Below is a script I wrote to add a new line item to the CI module (I copied and pasted from several places).
If SetSession("C/I", "CI_ItemCode_UI") Then
writeLog("Connection Complete - Item Maintenance")
Try
oCILineItem = oScript.NewObject("CI_ItemCode_bus", oSS)
Catch
MAS90_ConnectionPanel.lastError = "Could not create Line Item Object: " & oSS.sLastErrorMsg
writeLog(MAS90_ConnectionPanel.lastError)
Exit Sub
End Try
createLineItem(itemcode, description, productLine, primaryVendor)
Else
writeLog("Could not set Line Item Session")
End If
^^^^All of that works great
Private Sub createLineItem(ByVal itemcode As String, ByVal description As String, ByVal productLine As String, ByVal primaryVendor As String)
writeLog("Creating new Line Item...")
writeLog(itemcode)
oCILineItem.nSetKey(itemcode)
oCILineItem.nSetValue("ItemCodeDesc$", description)
oCILineItem.nSetValue("ProductLine$", "WIN")
oCILineItem.nSetValue("ProductType$", "F")
oCILineItem.nSetValue("PriceCode$", "9")
oCILineItem.nSetValue("AllowBackOrders$", "Y")
oCILineItem.nSetValue("StandardUnitOfMeasure$", "EACH")
oCILineItem.nSetValue("PurchaseUnitOfMeasure$", "EACH")
oCILineItem.nSetValue("SalesUnitOfMeasure$", "EACH")
oCILineItem.nSetValue("DefaultWarehouseCode$", "000")
oCILineItem.nSetValue("PrimaryVendorNo$", primaryVendor)
oCILineItem.nSetValue("ProcurementType$", "BUY")
oCILineItem.nSetValue("TaxClass$", "TX")
oCILineItem.nSetValue("Valuation$", "4")
If CBool(oCILineItem.nSetKey()) Then
writeLog("Line Item Created: " & itemcode)
writeLog(itemcode & " , " & description & " , " & productLine & " , " & primaryVendor)
writeLineItem(itemcode)
Exit Sub
Else
MAS90_ConnectionPanel.lastError = "Line Item could not be set: " & oCILineItem.sLastErrorMsg
writeLog(MAS90_ConnectionPanel.lastError)
End If
End Sub
For some reason when I do nSetKey(itemcode), I get this error:
<Error: 0 in Method SETVALUE> at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
Not sure what I'm doing wrong here since the example here uses the same technique that I am:
Any thoughts at all are appreciated, thank you!