Qingiz
09/16/2025, 1:57 PMCeligo AI
09/16/2025, 1:57 PMAI generated answer (using internal Slack threads):To set a sublist value when creating a new invoice from a sales order via script, you can use the
setSublistValue
method provided by SuiteScript. This method allows you to set the value of a field on a sublist line.
Here is a sample code snippet that demonstrates how to use this method:
javascript
var soRecord = record.load({
type: record.Type.SALES_ORDER,
id: appliedtointernalid.value
});
var abc = soRecord.setSublistValue({
sublistId: 'item',
fieldId: 'custcol_pi_projectforsoline',
line: linenum,
value: jobtoset.value
});
var recId = soRecord.save();
In this example, record.load
is used to load the sales order record. The setSublistValue
method is then used to set the value of a custom field (custcol_pi_projectforsoline
) on the 'item' sublist. The line
parameter specifies the line number on the sublist, and the value
parameter specifies the new value for the field. Finally, the save
method is used to save the changes to the record.
Please note that the line number is 0-based and you need to ensure that you are hitting the correct/expected line. You might need to find the right line by looping through or calling findSublistLineWithValue
if necessary.
******
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
09/16/2025, 1:57 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.861023128
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840454161
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84021
Celigo AI
09/16/2025, 1:57 PM