Hello, I have a client side script and a button th...
# suitescript
c
Hello, I have a client side script and a button that happens on Sales Orders. When the button is clicked it goes thru all the line items and checks a checkbox and copies the "Amount" field to a custom Amount field. For orders with over 50 line items it takes forever and sometimes completely crashes the browser. On the same script there is a validateLine function which is why i think is why it is taking so long. Can anyone help advise me on how to make the script run faster?
b
you probably want to be more specific. "Forever" could be perfectly normal in this case. Client script mimics whatever a user can do, so however long a takes a fast user to modify 50 lines is what you should expect for performance
if you think the validateLine is taking too long, just write logic at the top to return true if your button press is triggering the edit
i can't really offer alternatives since i see no reason why you can't just copy the sales order total
c
it takes about 5-10 minutes to go thru all the line items and the screen goes completely white. We are copying the amount on the line item and pushing it to another column field as well as checking a box within the line item so i didnt expect it to take that long
b
that peformance sounds suspect, i would expect about a minute at worst
your (or other) client scripts may be slowing down the process