have you got sourcing set to true?
# general
k
have you got sourcing set to true?
t
How can I check this? Thanks for responding
k
Within the script file?
can you post your code?
t
I see, I just am calling save() without options, I am assuming I need to add something like: sales_order.save({ enableSourcing : true, });
This is the rest of the relevant code:
Copy code
var sales_order = Nrecord.create({
    type: Nrecord.Type.SALES_ORDER,
    isDynamic: true,
    defaultValues: {
      entity: datain.customer_id
    }
});

function commitNewItem(item) {
    sales_order.selectNewLine('item');
    sales_order.setCurrentSublistValue('item', 'item', item.internalid);
    sales_order.setCurrentSublistValue('item', 'quantity', item.quantity);
    sales_order.commitLine('item');
}

for (var i = 0; i < datain.items.length; i++) {
    commitNewItem(datain.items[i]);
}

sales_order.save()
I tried it with
Copy code
sales_order.save({
  enableSourcing : true,
});
but no luck still.
k
Sorry was on phone.
t
no problem at all, thanks for taking a look
For class field, we use a custom field name "Product Line" - am wondering if this would affect it.
k
Quite Possibly. May just be easier to set it on the script.
t
Just ended up doing that. Thanks for your help Karl.