Hi, I have a User Event that gets some data from c...
# suitescript
m
Hi, I have a User Event that gets some data from custom record but sometimes there is data missing, so I am trying to fail silently and I want to stop the User Event script from submitting the changes and then alert user of the error? How can I achieve this?
w
It depends on what you mean by "stop the user event script from submitting the changes". If don't want any of the users changes to be saved, then you have two options. 1. throw an error or throw a string in beforeSubmit 2. in beforeSubmit, fetch all the stored values in the database and re-set them. user runtime.getCurrentSession().set() to set some kind of message. In afterSubmit, make sure you redirect to the current record if you stored a message in beforeSubmit. In beforeLoad, display the potential message to the user in runtime.getCurrentSession().get() and then clear it.
y
Simply after checking your criteria and if it falls then throw the error