Code:
var itemFulfill = record.load({type:record.Type.ITEM_FULFILLMENT,id:’internalidoffulfillmentrec’});
// Set a custom field
itemFulfill.setValue({fieldId:’Some custom field’,value:’Some Value’});
// Set status to shipped
itemFulfill.setValue({fieldId:’status’,value:’ItemShip:C’});
// Add a new line item to package sublist
itemFulfill.selectNewLine({sublistId:’package’});
itemFulfill.setCurrentSublistValue({sublistId:’package’,fieldId:’packageweight’,value:weight});
itemFulfill.setCurrentSublistValue({sublistId:’package’,fieldId:’packagetrackingnumber’,value:trackingNumber});
// Commit Line
itemFulfill.commitLine({sublistId:’package’});
itemFulfill.save({
enableSourcing: true,
ignoreMandatoryFields: true
});