Look at the bottom there. You are calling this on...
# suitescript
m
Look at the bottom there. You are calling this on beforeSubmit even though you named the function AfterSubmit