
Description: When we update the items in sales orders or similar records that have inventory items, we might face the above error. By using this solution, we can resolve it.
Solution:
Remove the inventorydetail value from the sublist record so the configured inventory value will be deleted. refer below code currentRecord is the record that currently updating.
for (let i = 0; i < lineCount; i++){
currentRecord.selectLine({ sublistId: 'item', line: i });
//Do the functions
currentRecord.removeCurrentSublistSubrecord({ sublistId: 'item', fieldId: 'inventorydetail'});
currentRecord.commitLine({ sublistId: 'item' });
}