Nour Khaled
05/21/2025, 10:22 AMCeligo AI
05/21/2025, 10:22 AMAI generated answer (using internal Slack threads):Based on the conversations, it seems like the issue is related to the use of
setSublistValue
function in SuiteScript. The setSublistValue
function requires a line number to be specified, but in dynamic mode, you can use selectLine
to select the line and then getCurrentSublistValue
to get the value.
Here is an example of how you can use selectNewLine
and `setCurrentSublistValue`:
javascript
{
record = require('N/record');
itemSublist = 'inventory';
newrec = record.create({
type: 'inventorytransfer',
dynamic: true,
defaultValues: {}
});
newrec.setValue({fieldId: 'subsidiary', value: 1});
newrec.setValue({fieldId: 'transferlocation', value: 19});
newrec.setValue({fieldId: 'location', value: 25});
newrec.selectNewLine({sublistId: itemSublist});
newrec.setCurrentSublistValue({sublistId: itemSublist, fieldId: 'itemreceive', value: true});
newrec.setCurrentSublistValue({sublistId: itemSublist, fieldId: 'quantity', value: 10});
newrec.getCurrentSublistSubrecord({sublistId: itemSublist, fieldId: 'inventorydetail'});
console.log(newrec.hasSublistSubrecord({sublistId: itemSublist, fieldId: 'inventorydetail', line: 0}))
}
Remember to select the line first before getting the sublist value in dynamic mode.
******
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
05/21/2025, 10:22 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.877265036
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.867913663
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.865696967
Celigo AI
05/21/2025, 10:22 AM