Hello team, Am getting TRANS_AMTS_UNBALNCDTransac...
# suitescript
r
Hello team, Am getting TRANS_AMTS_UNBALNCDTransaction is not in balance! amounts+taxes+shipping: 1, total amount: 6 while transforming sales order to invoice for specific line items via script, if i transform with all line items its saving successfully. From UI with specific line items its working but from script its not. Can anyone help me on this?
b
what does the code look like
r
// transform sales order to invoice var transformRecord = record.transform({ fromType: 'salesorder', fromId: soid, toType: 'invoice', isDynamic: true }); // get sublist line count var lineCount = transformRecord.getLineCount('item'); for (var j = lineCount - 1; j >= 0; j--) { // get the line id var lineId = transformRecord.getSublistValue('item', 'orderline', j); // identify the line id is aviable in our so lines var soLineRecords = soLines.filter(function(e) { return e.lineId == lineId; }); if (soLineRecords.length == 0) { var item = transformRecord.getSublistText('item', 'item', j); log.debug("removed item", item); transformRecord.removeLine({ sublistId: 'item', line: j, ignoreRecalc: true }); } } var invoiceId = transformRecord.save(); log.debug('invoiceId', invoiceId);
b
you want that recalc to happen so that the total can be updated
r
Thanks a lot @battk Its working now after removing the recalc