Jeniffer
05/22/2025, 8:49 PMCeligo AI
05/22/2025, 8:50 PMAI generated answer (using internal Slack threads):To change the linked order on a line item with the N/record module, you can use the
setSublistValue
method. This method allows you to set the value of a field on a sublist line.
Here is a sample code snippet:
javascript
var record = require('N/record');
var myRecord = record.load({
type: record.Type.SALES_ORDER,
id: '123',
isDynamic: true,
});
var numLines = myRecord.getLineCount({
sublistId: 'item'
});
for (var i = 0; i < numLines; i++) {
myRecord.selectLine({
sublistId: 'item',
line: i
});
myRecord.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'order',
value: 'newOrderValue'
});
myRecord.commitLine({
sublistId: 'item'
});
}
myRecord.save();
In this example, we're loading a Sales Order record, iterating over each line in the 'item' sublist, and setting a new value for the 'order' field on each line. The isDynamic: true
option is used to work with the record in a dynamic manner, which allows us to use the selectLine
, setCurrentSublistValue
, and commitLine
methods.
Please replace 'newOrderValue'
with the actual value you want to set.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
05/22/2025, 8:50 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.804418743
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.804308176
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.802906632
Celigo AI
05/22/2025, 8:50 PM