Nour Khaled
02/09/2025, 9:58 AMCeligo AI
02/09/2025, 9:58 AMAI generated answer (using internal Slack threads):The error message "TypeError: poRec.setSublistValue is not a function" is likely due to the fact that the
setSublistValue
method is not available when the record is in dynamic mode.
In NetSuite SuiteScript, there are two modes for handling records: dynamic mode and standard mode. The setSublistValue
method is used in standard mode, while dynamic mode uses a different set of methods for handling sublist values.
If you're using dynamic mode (i.e., isDynamic: true
), you should use the selectLine
, setCurrentSublistValue
, and commitLine
methods to handle sublist values. Here's an example:
javascript
var item_record = record.load({
type: record.Type.INVENTORY_ITEM,
id: item_id,
isDynamic: true,
});
item_record.selectLine({sublistId: 'price1', line: 10})
item_record.setCurrentSublistValue({
sublistId: 'price1',
fieldId: 'price_1_',
value: display_price
});
item_record.commitLine({sublistId: 'price1'});
If you want to use setSublistValue
, you should load the record in standard mode (i.e., isDynamic: false
):
javascript
var item_record = record.load({
type: record.Type.INVENTORY_ITEM,
id: item_id,
isDynamic: false,
});
item_record.setSublistValue({
sublistId: 'price1',
fieldId: 'price_1_',
line: 10,
value: display_price
});
Remember to save the record after making changes.
******
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
02/09/2025, 9:59 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.860146284
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.85055995
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849711716
Celigo AI
02/09/2025, 9:59 AM