Nour
10/01/2025, 7:51 PMCeligo AI
10/01/2025, 7:51 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems that you can't directly modify the 'quantity committed' via SuiteScript, but you can modify the 'quantity' which indirectly affects the 'quantity committed'. To implement your requirement, you can use SuiteScript 2.0 to check if the lot inventory number ends with '24', commit the current line, and then add a new line with the same item but with a quantity of 2 and a rate of 0. Here is a sample code snippet that might help you:
javascript
define(['N/record'], function(record) {
function checkLotNumberAndAddLine(recordId) {
var itemRecord = record.load({
type: record.Type.INVENTORY_ITEM,
id: recordId
});
var numLines = itemRecord.getLineCount({sublistId: 'inventory'});
for (var i = 0; i < numLines; i++) {
var lotNumber = itemRecord.getSublistValue({
sublistId: 'inventory',
fieldId: 'lotnumber',
line: i
});
if (lotNumber.endsWith('24')) {
itemRecord.selectLine({sublistId: 'inventory', line: i});
itemRecord.commitLine({sublistId: 'inventory'});
itemRecord.selectNewLine({sublistId: 'inventory'});
itemRecord.setCurrentSublistValue({
sublistId: 'inventory',
fieldId: 'item',
value: itemRecord.getValue({fieldId: 'item'})
});
itemRecord.setCurrentSublistValue({
sublistId: 'inventory',
fieldId: 'quantity',
value: 2
});
itemRecord.setCurrentSublistValue({
sublistId: 'inventory',
fieldId: 'rate',
value: 0
});
itemRecord.commitLine({sublistId: 'inventory'});
}
}
itemRecord.save();
}
return {
checkLotNumberAndAddLine: checkLotNumberAndAddLine
};
});
This script loads an inventory item record, iterates over the inventory sublist, checks if the lot number ends with '24', commits the line, and adds a new line with the same item, a quantity of 2, and a rate of 0.
******
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
10/01/2025, 7:51 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.852478147
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840637207
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839172363
Celigo AI
10/01/2025, 7:51 PM