Can I add a line to the item sublist on a sales or...
# ask-stanley-ai
s
Can I add a line to the item sublist on a sales order without loading the sales order record?
c
AI generated answer (using internal Slack threads):
Yes, you can add a line to the item sublist on a sales order without loading the sales order record. This can be achieved by using the
N/record
module's
insertLine
method in SuiteScript 2.0. Here is an example:
Copy code
javascript
var record = require('N/record');

var recordId = record.insertLine({
    recordType: 'salesorder',
    fieldId: 'item',
    line: 0,
    value: 'your item id'
});
In this example,
recordType
is the type of record,
fieldId
is the ID of the sublist field,
line
is the line number where the new line should be inserted, and
value
is the value to set for the new line. Please note that this method will only insert a new line and will not commit it. You will need to use the
commitLine
method to save the changes to the record.
Copy code
javascript
record.commitLine({
    sublistId: 'item'
});
Remember to always test your code in a sandbox environment before deploying it to production. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838175058
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836852193
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832591593
Please provide your feedback on this answer.