I’m trying to add a validation to prevent a sales ...
# suitescript
l
I’m trying to add a validation to prevent a sales order to be “pending fulfillment” unless it has shipping address associated and with most fields filled. I wrote a UserEventScript and noticed that both the
context.oldRecord
and the
context.newRecord
both has the same status like ‘Pending Approval’ even when I click on Approve button. So I thought the way to know it was changing the status was by adding a condition like
context.type == context.UserEventType.APPROVE
now it works when user clicks on the button, but if they edit the sales order and change the status drop down it allows to save. Has anyone faced something similar to this?