This topic contains 2 replies, has 0 voices, and was last updated by david.smith 7 years, 9 months ago.
-
AuthorPosts
-
February 21, 2017 at 9:00 am #1150
WakaWakaI’ve tried various combinations of setSublistValue and setSublistText with the internal id and/or name of the tax code, but everything I try either returns an INVALID_FLD_VALUE error or INVALID_KEY_OR_REF error. The code below returns a INVALID_FLD_VALUE error. I’ve talked to other people in my company and there shouldn’t be anything wrong with how we have netsuite configured. However, I am successfully able to do this in the UI which would mean I must be doing something wrong in my code. Any input would be greatly appreciated! Feel free to let me know if more details are needed.
Code:
//generate some test records to use for deletion
oppRec = nsRecord.create({ //returns a record.Record
type: nsRecord.Type.OPPORTUNITY,
defaultValues: {
entity: 2694
}
});
oppRec = oppRec.save(); //returns the internal id of the newly created record//transform opp record into estimate
var estRec = nsRecord.transform({
fromType: nsRecord.Type.OPPORTUNITY,
fromId: oppRec,
toType: nsRecord.Type.ESTIMATE
});
estRec.setSublistValue({
sublistId: ‘item’,
fieldId: ‘item’,
value: 25, //ball-point pens
line: 0
});
estRec.setSublistValue({
sublistId: ‘item’,
fieldId: ‘quantity’,
value: 4,
line: 0
});
estRec.setSublistValue({
sublistId: ‘item’,
fieldId: ‘taxcode’,
value: -453,
line: 0
});
estRec = estRec.save();
This is a cached copy. Click here to see the original post. -
February 21, 2017 at 9:11 am #1151
david.smith1) Check your tax code id. To view existing tax codes in your NetSuite account, go to Setup > Accounting > Taxes > Tax Codes (Administrator).
2) Use line “1” not 0
WakaWaka replied on 02/21/2017, 09:51 AM: I’ve checked the tax code id many times over.
Using line 1 get me an UNEXPECTED_ERROR code thrown on the first estRec.setSublistValue
-
February 21, 2017 at 9:58 am #1152
david.smithSorry, my bad. I didn’t look closely enough to see you were using SS2.0. I’ve been bouncing back and forth (old habits).
Try this, make all of your numeric values strings.
Code:
estRec.setSublistValue({ sublistId: ‘item’, fieldId: ‘taxcode’, value: ‘-453’, line: 0 });
-
AuthorPosts
You must be logged in to reply to this topic.