Heya folks, I know there are several buttons in Ne...
# suitescript
m
Heya folks, I know there are several buttons in Netsuite that can enter in multiple line items at a time into a transaction, client side. Is there any way to do this with client side Suitescript? Trying to avoid having to add lines individually since it either breaks sourcing if you do it really quickly, or it is really slow as you wait for sourcing to finish.
c
A client-side SuiteScript can batch lines, but sourcing’s the bottleneck. You can use nlapiSetLineItemValue in a loop, but it’ll still trigger sourcing per line. One workaround: disable sourcing temporarily with nlapiDisableLineItemField, add all lines, then re-enable.
m
@christianRILECPQ Hmmm... I'll try this and see how it works.
Found a way to get things to work. The trick is to make every nlapiSetCurrentLineItemValue synchronous
If it is synchronous, I don't have to guess and wait for how long a line will take to be filled. I can just do it as fast as the function returns, which ends up being faster than trying to time things correctly.
It does freeze up the record for a bit, but this actually might be okay with our users for this particular script