Is there anyway with a beforeLoad user event script to prevent the record from being saved and redirect the UI to a different page?
michoel
10/08/2020, 3:59 AM
I figured out one way which is technically an XSS attack `throw 'You cant save this record. You will be redirected soon. <img src="#" onerror="window.location=`https://google.com`;" />'`
michoel
10/08/2020, 3:59 AM
Hoping there is something more supported
e
ec
10/08/2020, 4:16 AM
Wouldn't you catch this in a beforeSubmit and redirect using the redirect module? Or if you catch the scenario in beforeLoad you can do the same.
m
michoel
10/08/2020, 4:44 AM
The script I'm working on is 1.0. I tested nlapiRedirectUrl but it didn't do anything in a beforeSubmit
michoel
10/08/2020, 4:58 AM
Another option I came up with is move the logic to afterSubmit and if the record shouldn't have been allowed to be created, delete it and then redirect
e
ec
10/08/2020, 9:37 PM
Can't you prevent a save in beforeSubmit? You still may be able to redirect in the afterSubmit...
m
michoel
10/08/2020, 10:06 PM
I'm preventing the save in beforeSubmit by throwing an error. Just tested this to be sure, but if I throw an error in beforeSubmit, then the afterSubmit doesn't run