I have written a client script on invoice record ...
# suitescript
s
I have written a client script on invoice record function autofillTaxDetails(context){ try{ var currRec=context.currentRecord; var taxdetailsoverrideu=currRec.getValue('taxdetailsoverride'); if(taxdetailsoverrideu == true){ var lc=currRec.getLineCount('taxdetails'); var autoFill=currRec.getValue('custbody_ctl_autofilltaxdetails'); log.debug('lc===>',lc); if (lc > 0){ var taxrate=currRec.getSublistValue({ sublistId:'taxdetails', fieldId:'taxrate', line:0 }); log.debug('taxrate',taxrate); var taxamount=currRec.getSublistValue({ sublistId:'taxdetails', fieldId:'taxamount', line:0 }); log.debug('taxamount',taxamount); } if (autoFill == true){ log.debug('start time'); for(var i=1; i< lc; i++){                         //  log.debug('enter in loop');   currRec.selectLine({   sublistId: 'taxdetails',   line: i   });      currRec.setCurrentSublistValue({   sublistId: 'taxdetails',   fieldId: 'taxamount',     value:taxamount  });                             currRec.setCurrentSublistValue({   sublistId: 'taxdetails',   fieldId: 'taxrate',     value:taxrate  });   currRec.commitLine({   sublistId: 'taxdetails'   }); }                           log.debug('end time'); } } } catch(e){ log.debug(e.name,e.message); } } this is my script on "save record" function.After executing this for more than 100 lines my page becomes unresponsive. Is there any other way I can achieve?
n
Do it in a user event script if your use case fits, I'd avoid doing anything in client script save, if you can avoid it, particularly if you're iterating through lines updating them.
s
@NElliott Ntried with UE still taking around 20 mins to udate more than 500 lines