Ours are populating transaction columns with 'poin...
# suitescript
s
Ours are populating transaction columns with 'point in time' detail with logic based on combination of item fields and user/subsidiary
b
Not related to asynchronous, but afterSubmit is generally the worst place to modify the created sales order. It causes the sales order to be saved twice, its terrible for performance. If possible, do it in beforeSubmit
👍 1
s
@battk NetSuite Professional services implemented this... netsuite @Ben Irving
b
They may have had a good reason to do so, my comment was just to suggest an alternative of moving the code to beforeSubmit (if possible) if you are having performance concerns
s
For our use case the script in question does nothing essential for processing the sale, just populates column info. In the web store context it makes way more sense to schedule a script and bail - the script will still do it's thing in the background. I don't understand why PS wouldn't hand off the heavy work to a scheduled script when currently it causes such an obvious slow down in the UI and SCA Stores.
b
Essential sale information is one thing that can determine beforeSubmit or afterSubmit. Another is if the column data requires the record to already exist. If the column requires data that only exists after the record ha been saved, then an afterSubmit is required
or at the very least, a call to a scheduled script like you suggested
If its not essential, you might consider just moving the aftersubmit logic to a map reduce or scheduled script