So I'm trying to add a service for sale line item ...
# suitescript
y
So I'm trying to add a service for sale line item to an SO using SS1.0, but I keep on getting the error "You must enter at least one line item for this transaction.". Does anyone know how I can programmatically add that in? I've tried this for example: var salesOrder = nlapiCreateRecord('salesorder', { recordmode: 'dynamic' }) salesOrder.setLineItemValue('serviceitem', 'item', 1, 1234); var salesOrderId = nlapiSubmitRecord(salesOrder, true, true); Am I doing something wrong here?
w
should be: salesOrder.setLineItemValue(“item”, “item”, 1, 1234); the first parameter is the sublistId, second is the columnId or fieldId, third is index, fourth is value which in this case is the item Internal ID
y
@wbermudo I had actually tried this too and would get the following error when doing so: "TypeError: Cannot call method "replace" of null (NLRecordScripting.scriptInit$lib#5134)" I figured that must mean that the item doesn't exist, but I've gone in and hardcoded the internal ID to try that, and still would come across the same bug. Is a service for sale still technically an inventory item? I'm not too sure how I can identify whether it is a sublist, or something else entirely
s
I must say, strongly consider using SS2.1 if this is new code.
y
@stalbert yeah I was thinking actually that it might be worthwhile trying out in a newer version, thank you! I'll give that a go and see how I manage 🙂 hopefully that won't have any issues