Aaron McCausland
12/30/2025, 5:06 AMCeligo AI
12/30/2025, 5:06 AMAI generated answer (using internal Slack threads):To set a Cost Category on a Landed Cost subrecord of an Item line in an Item Receipt in SuiteScript 2.1 user event script beforeSubmit function, you can use the
record module to load the Item Receipt record and then use the getSublistSubrecord method to access the Landed Cost subrecord.
Here is a sample code snippet:
javascript
var item_receipt = record.load({
type: 'itemreceipt',
id: itemReceiptId
});
var existing_sublist = item_receipt.hasSublistSubrecord({
sublistId: 'item',
fieldId: 'landedcost',
line: lineId
});
var existing_landed_cost = item_receipt.getSublistSubrecord({
sublistId: 'item',
fieldId: 'landedcost',
line: lineId
});
existing_landed_cost.setSublistValue({
sublistId: 'landedcostdata',
fieldId: 'landedcostcategory',
value: 1,
line: lineId
});
In this code:
- itemreceipt is the type of the record being loaded.
- itemReceiptId is the ID of the Item Receipt record.
- item is the sublistId for the item sublist on the Item Receipt record.
- landedcost is the fieldId for the Landed Cost subrecord on the item sublist.
- lineId is the line number of the item on the sublist.
- landedcostdata is the sublistId for the Landed Cost Data sublist on the Landed Cost subrecord.
- landedcostcategory is the fieldId for the Cost Category field on the Landed Cost Data sublist.
- 1 is the value being set for the Cost Category field.
Please note that you need to replace itemReceiptId and lineId with the actual ID of the Item Receipt record and the line number of the item on the sublist 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
12/30/2025, 5:06 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.866088927
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836609
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.835052609
Celigo AI
12/30/2025, 5:06 AM