get out of dynamic mode would be my first recommen...
# suitescript
s
get out of dynamic mode would be my first recommendation
👍 1
d
Then I am receiving this error: TypeError: Cannot find function selectNewLine in object standard record.
s
What context are you making this record, like what type of script is this?
d
it is schedule script
s
use insertLine instead
IIRC
s
Use
N/record
methods instead of
N/currentRecord
methods, no selecting lines, no
setCurrentLineValue
, no commitLine. just
rec.setSublistValue()
d
okay let me try that
@Sandii I am receiving
Copy code
type: "internal error",
      code: "UNEXPECTED_ERROR",
in this case
salesOrder.setSublistValue({                 sublistId: 'item',                 fieldId: 'item',                 line: 1,                 value: itemId             });             salesOrder.setSublistValue({                 sublistId: 'item',                 fieldId: 'quantity',                 line: 1,                 value: quantity             });
this is the code I have used
@stalbert insertLine didn't work as well.
s
if you don't need to actually add lines, then no need to insert - just set values like you've shown above on existing lines (1)
d
either the case I am still getting enter value for tax code error
s
did you try including a tax code (i.e. set the
taxcode
field)?
d
I am wondering why is it allowing in UI then? if tax code is not given? any ideas
no, because in UI it is working without taxcode given. I am using same item and customer.
And when I gave the tax code in the script like you said. Now I am getting
Copy code
"Please enter a value for amount.
error. Why are the fileds not souring?
r
The fields are not sourcing because you are not in dynamic mode. Does the item have a default/preferred price level? If there is non setup for the Item, even if you are dynamic mode, amount will not be populated
e
Try specifying the customerId and the customFormId...
s
Line indexes start at 0 not 1
d
@Sandii Yes, I have changed the line numbers and still tried. I am getting this error in standard mode with setSublistValue.
can we not ignore tax code field on sales order via script?