Ours are populating transaction columns with 'point in time' detail with logic based on combination of item fields and user/subsidiary
b
battk
04/11/2019, 5:24 AM
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
Steve82
04/11/2019, 11:04 AM
@battk NetSuite Professional services implemented this... netsuite@Ben Irving
b
battk
04/11/2019, 3:06 PM
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
Steve82
04/12/2019, 12:57 AM
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
battk
04/12/2019, 1:03 AM
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
battk
04/12/2019, 1:05 AM
or at the very least, a call to a scheduled script like you suggested
battk
04/12/2019, 1:06 AM
If its not essential, you might consider just moving the aftersubmit logic to a map reduce or scheduled script