RE: Why do I get “field.getSublistName is not a function” when setting a sublist value?
I’m trying to transform a sales order to an item fulfillment using a SS 2.0 button event handler. As simple as possible. Not trying to do anything complicated. Surely something that has been done thousands of times before.
I get error “field.getSublistName is not a function” on the line after the todo:
var itemFulfillment = record.transform({ fromType: record.Type.SALES_ORDER, fromId: salesOrderId, toType: record.Type.ITEM_FULFILLMENT, isDynamic: true }); var lineCount = itemFulfillment.getLineCount({ sublistId: 'item' }); log.debug({ title: FUNCTION_NAME, details: { lineCount: lineCount } }); for (var i = 0; i < lineCount; i++) { itemFulfillment.selectLine({ sublistId: 'item', line: i }); log.debug({ title: FUNCTION_NAME, details: '1' }); //todo error on next time: field.getSublistName is not a function itemFulfillment.setCurrentSublistValue({ sublistId: 'item', fieldId: 'itemreceive', value: true }); log.debug({ title: FUNCTION_NAME, details: '2' }); itemFulfillment.commitLine({ sublistId: 'item' }); } log.debug({ title: FUNCTION_NAME, details: '3' }); const id = itemFulfillment.save();
If I try in non-dynamic mode then I get the same error:
var itemFulfillment = record.transform({ fromType: record.Type.SALES_ORDER, fromId: salesOrderId, toType: record.Type.ITEM_FULFILLMENT }); var lineCount = itemFulfillment.getLineCount({ sublistId: 'item' }); log.debug({ title: FUNCTION_NAME, details: { lineCount: lineCount } }); for (var i = 0; i < lineCount; i++) { log.debug({ title: FUNCTION_NAME, details: '1' }); //todo error on next time: field.getSublistName is not a function itemFulfillment.setSublistValue({ sublistId: 'item', line: i, fieldId: 'itemreceive', value: true }); log.debug({ title: FUNCTION_NAME, details: '2' }); } log.debug({ title: FUNCTION_NAME, details: '3' }); const id = itemFulfillment.save();
Hello,
i use this code and i have no problems
var salesOrderId=XXXXXX
var itemFulfillment = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: salesOrderId,
toType: record.Type.ITEM_FULFILLMENT,
// isDynamic: true
});
var lineCount = itemFulfillment.getLineCount({
sublistId: ‘item’
});
for (var i = 0; i < lineCount; i++) {
// itemFulfillment.setSublistValue({“sublistId”: “item”, “fieldId”: “itemreceive”, “value”: true, “line”: i});
var line = itemFulfillment.getSublistValue({
sublistId:’item’, // nome della sublist
fieldId:’line’, // nome del campo
line:i
});
itemFulfillment.setSublistValue({
sublistId: ‘item’,
fieldId: ‘itemreceive’,
value: true,
line: i
});
}
itemFulfillment.save()
ciao
Mauro
This gives me the same issue. Note, I have the auto-fulfill feature disabled. Performing any “setSubListValue” or “setCurrentSublistValue” results in the same “field.getSublistName is not a function”