How do you create a Netsuite invoice with multiple line

Hi, i am new in this filed, getting error  ::

{“type”:”error.SuiteScriptError”,”name”:”UNABLE_TO_SAVE_THE_TRANSACTION_DUE_TO_AN_ERROR_BEING_REPORTED_BY_THE_TAX_CALCULATION_ENGINE_1″,”message”:”Unable to save the transaction due to an error being reported by the tax calculation engine: A User Error Has Occurred: Duplicate input lines detected. Tax Details Reference: ”.”,”stack”:[“Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at inv_finalized (/SuiteScripts/flx_saas_inv_sheduler.js:286:51)\n at saasInvAddOrUpdate (/SuiteScripts/flx_saas_inv_sheduler.js:145:39)\n at Object.execute (/SuiteScripts/flx_saas_inv_sheduler.js:122:13)”],”cause”:{“type”:”internal error”,”code”:”UNABLE_TO_SAVE_THE_TRANSACTION_DUE_TO_AN_ERROR_BEING_REPORTED_BY_THE_TAX_CALCULATION_ENGINE_1″,”details”:”Unable to save the transaction due to an error being reported by the tax calculation engine: A User Error Has Occurred: Duplicate input lines detected. Tax Details Reference: ”.”,”userEvent”:null,”stackTrace”:[“Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at inv_finalized (/SuiteScripts/flx_saas_inv_sheduler.js:286:51)\n at saasInvAddOrUpdate (/SuiteScripts/flx_saas_inv_sheduler.js:145:39)\n at Object.execute (/SuiteScripts/flx_saas_inv_sheduler.js:122:13)”],”notifyOff”:false},”id”:””,”notifyOff”:false,”userFacing”:true}
My code :

if( itemObj!= false && itemObj!=” && itemObj!=null ){
letitemObjLength=itemObj.length;
lettest=0;
//for( let itemIndex=0; itemIndex<itemObjLength; itemIndex++){//not wrking
for( letitemIndex=itemObjLength; itemIndex>0; itemIndex–){
//for( let itemIndex=itemObjLength-1; itemIndex>=0; itemIndex–){
letitemIndexValue=itemIndex-1;
log.debug(“itemObj[itemIndex-1].item_intrnl_id”,itemIndexValue+”<=>”+itemIndex+”<=>”+itemObj[itemIndexValue].item_intrnl_id);//manoj
if( itemIndex == itemObjLength ){
log.debug(“Equal”,itemIndexValue+ “test: “+test);
inv_rec.selectNewLine({sublistId:’item’});
}else{
log.debug(“Not Equal”,itemIndexValue+ “test: “+test);
//inv_rec.selectLine({sublistId:’item’,line:itemIndexValue});
inv_rec.selectLine({sublistId:’item’,line:test});
//inv_rec.insertLine({sublistId: “item”,line: test});
//inv_rec.insertLine({sublistId: “item”,line: itemIndexValue});
}
test=test+1;
inv_rec.setCurrentSublistValue({
sublistId:’item’,fieldId:’item’,
value:itemObj[itemIndexValue].item_intrnl_id,
ignoreFieldChange: true,forceSyncSourcing: true
});
inv_rec.setCurrentSublistValue({
sublistId: ‘item’,fieldId: ‘quantity’,
value:itemObj[itemIndexValue].itm_quantity,
ignoreFieldChange: true,forceSyncSourcing: true
});
inv_rec.setCurrentSublistValue({
sublistId: ‘item’,fieldId: ‘rate’,
value:itemObj[itemIndexValue].unit_amount,
ignoreFieldChange: true,forceSyncSourcing: true
});
inv_rec.setCurrentSublistValue({
sublistId: ‘item’,fieldId: ‘amount’,
value:itemObj[itemIndexValue].tot_amount,
ignoreFieldChange: true,forceSyncSourcing: true
});
inv_rec.setCurrentSublistValue({
sublistId: ‘item’,fieldId: ‘grossamt’,
value:itemObj[itemIndexValue].tot_amount,
ignoreFieldChange: true,forceSyncSourcing: true
});
inv_rec.setCurrentSublistValue({
sublistId: ‘item’,fieldId: ‘description’,
value:itemObj[itemIndexValue].item_description,
ignoreFieldChange: true,forceSyncSourcing: true
});
inv_rec.commitLine({ sublistId: ‘item’});
//inv_tax_linename=itemObj[itemIndex-1].item_disp_name
}//for loop closed
}//if closed

Rookie Asked on March 18, 2023 in Items.
Add Comment
1 Answer(s)

Hi,

You could try to add information at the line level  regarding the tax (tax code, tax rate).

Rookie Answered on March 20, 2023.

Can you please elaborate little bit more.

on March 20, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor