Has anyone encountered this error when saving a tr...
# suitescript
u
Has anyone encountered this error when saving a transaction record?
"TRANS_NOT_COMPLETED"
im in dynamic mode and im trying applying time tracking records to the invoice. here is a snippet of my code:
Copy code
let invoice = record.create({
    type:'invoice',
    isDynamic:true
});
let fields = [
    {
        fieldId:'entity',
        value:456
    },
    {
        fieldId:'job',
        value:458
    }
]
for(field of fields) invoice.setValue(field);

var linecount = invoice.getLineCount('time');

if(linecount > 0){
    for(let i = 0; i < linecount; i++){
        invoice.selectLine({
            sublistId:'time',
            line:i
        });
        invoice.setCurrentSublistValue({
            sublistId:'time',
            fieldId:'apply',
            value:true
        });
        invoice.commitLine({
            sublistId:'time'
        })
    }
}

invoice.save();