Anas Jakwani
06/11/2025, 3:40 PMCeligo AI
06/11/2025, 3:40 PMAI generated answer (using internal Slack threads):To get the item group price from a transaction line in SuiteScript 2.0, you would need to load the transaction record and then iterate over the line items to find the item group and its price. Here is a sample code snippet:
javascript
var record = require('N/record');
function getItemGroupPrice(transactionId) {
var transactionRecord = record.load({
type: record.Type.SALES_ORDER, // replace with your transaction type
id: transactionId
});
var numLines = transactionRecord.getLineCount({ sublistId: 'item' });
for (var i = 0; i < numLines; i++) {
var itemId = transactionRecord.getSublistValue({
sublistId: 'item',
fieldId: 'item',
line: i
});
var itemRecord = record.load({
type: record.Type.NON_INVENTORY_ITEM, // replace with your item type
id: itemId
});
if (itemRecord.getValue({ fieldId: 'itemtype' }) === 'Group') {
var price = transactionRecord.getSublistValue({
sublistId: 'item',
fieldId: 'rate',
line: i
});
return price;
}
}
return null;
}
This function loads a transaction record, iterates over its line items, and checks if the item type is 'Group'. If it is, it retrieves the price of the item group from the transaction line and returns it.
Please replace 'SALES_ORDER' and 'NON_INVENTORY_ITEM' with your actual transaction type and item type, respectively.
******
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
06/11/2025, 3:40 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.812315822
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.811284363
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810541
Celigo AI
06/11/2025, 3:40 PM