We have a user event afterSubmit script on Sales o...
# suitescript
d
We have a user event afterSubmit script on Sales orders that updates the shippingcost based on some criteria. The script is placed to run before the avatax script on the scripted records list but for some reason the tax does not get updated based on the new shipping cost. The tax stays the same and when we go edit the sales order, the tax changes. Isn't this flow supposed to work if the user event script executes before the avatax script? Any ideas?
p
A user event script doesn't trigger other user events. If you're loading and saving the order in aftersubmit, avatax is most likely not running
You might want to try setting the value beforesubmit, before avatax.
d
Thank you @PabloZ. I am aware a user event script doesn't trigger others. My thought was that mine executed first and saved and when avatax runs afterSubmit it should already have the updated shipping cost and recalculate tax properly. I was trying to do all of this beforeSubmit but when I set the value for shipmethod (which changes the shipping cost from 10 to 20 for example), rec.getValue("shippingcost") does not give me the most updated shipping cost of 20 but stays at 10. I have no clue why I cannot retrieve the updated shipping cost when changing shipmethod. Any ideas?