I am trying to create a Dropship Purchase Order via SuiteScript 2. I am able to create the Purchase order object with the correct Drop ship data (customer, Sales order, Dropship form) however I get the following error when saving
"You must enter at least one line item for this transaction.".
I can manually create the drop ship from the Sales Order and the items add fine. I am using Netsuite OneWorld.
Below is the code I'm using
var purchaseOrder = record.create({
type: record.Type.PURCHASE_ORDER,
isDynamic: true,
defaultValues: {
soid: 4427821,
dropship: true,
subsidiary: 9,
custid: 666,
entity: 322
}
});
purchaseOrder.setValue({
fieldId: "employee",
value: 3
});
log.debug("Item Count", purchaseOrder.getLineCount("item"));
log.debug("Entity", purchaseOrder.getText("entity"));
log.debug("Customer", purchaseOrder.getText("shipto"));
log.debug("Sales Order", purchaseOrder.getText("createdfrom"));
log.debug("Form", purchaseOrder.getText("customform"));
log.debug("Subsidiary", purchaseOrder.getText("subsidiary"));
purchaseOrder.save();
Here some screengrabs as well
I have existing scripts that create standalone POs, so I have some idea of the process required here. Is there a step I'm missing for Dropships specifically? I found this thread in which Will Charbonneau said this should be all you need Netsuite: How to link Purchase Order to Sales Order. I've tried Their code with my IDs, and it results in the same error.