I am trying to create a Sales Order and set its `c...
# suitescript
k
I am trying to create a Sales Order and set its
customform
value to 139. I have tried both
Copy code
const salesOrderRecord = record.create({
        type: record.Type.SALES_ORDER,
        isDynamic: true,
        defaultValues: {
            customform: 139
        }
});
and
Copy code
const salesOrderRecord = record.create({
        type: record.Type.SALES_ORDER,
        isDynamic: true
});

salesOrderRecord.setValue({
        fieldId: 'customform',
        value: 139
});
and both times I get the error
Copy code
"message":"You have entered an Invalid Field Value 0 for the following field: customform"
Where is it getting 0 from? Is this one of those Netsuite errors where the problem isn't actually with
customform
, but something else?
s
Couple of initial thoughts, try a string instead of number
'139'
. Also maybe order of operations matters here, I would assume you are setting other values aside from form. Perhaps try setting the form after other values (like sub or customer), not sure which order you are setting things.
👆🏻 1
k
customform is the very first field that is attempted to be set
b
looks weird
id make sure that you are using ss2.0 and that '139' is an active custom form for whatever context you are in
k
Sadly I do not have access to a user account on their Netsuite, but they have verified that 139 is the correct internal ID of their Sales Order custom form I did have the crossing thought that maybe they didn't have ss2.0 enabled in their account features, I will need to double check that with them
b
i meant it as in dont use suitescript 2.1
k
Actually enabling ss2.0 doesn't appear to be an account feature, hmm, but my @NApiVersion is set to 2.0 (and has previously errored out on 2.x)
m
I’d be curious what the error is if you just have some random id 99999 or the likes. Is it possible if isn’t a negative value id and they are not omitting the negative symbol