Ken
04/25/2023, 5:19 PM//transform SO to create a new Item fulfillment
var fulfillment = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: currentRecord.id,
toType: record.Type.ITEM_FULFILLMENT,
isDynamic: true
});
//get line count of newly created fulfillment
var lineCount = fulfillment.getLineCount({
sublistId: 'item'
});
//for each line set the "itemreceive" field to true
for (var i = 0; i < lineCount; i++) {
fulfillment.selectLine({
sublistId: 'item',
line: i
});
fulfillment.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'itemreceive',
value: true
});
//set other relevant sublist fields
fulfillment.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'fieldId',
value: 'value'
});
fulfillment.commitLine({
sublistId: 'item'
});
}
//set any other relevant itemreceive fields
itemreceive.setValue({
filedId: 'fieldId',
value: 'value'
});
//save the newly created itemreceive
var itemreceiveId = itemreceive.save({
enableSourcing: true, //optional, defaul is false
ignoreMandatoryFields: true //optional, defaul is false
});
Hi all, Is there a way for me to use Lineid instead of Line (index) to do transform from sales order to Item fulfillment? Because I'm getting error Null stackNElliott
04/25/2023, 7:18 PMfulfillment.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'fieldId',
value: 'value'
});
I presume you're supplying relevant fieldId's and value's...
As for your Lineid / Line question where are you using either and in what way are you thinking you're using either?Ken
04/26/2023, 5:25 PMKen
04/26/2023, 6:50 PM