I'm moving code from a client saveRecord that retu...
# suitescript
k
I'm moving code from a client saveRecord that returns false with an alert message if criteria are not met, and true if they are. It would be nice to be able to give the end users the same feedback if the afterSubmit action was or was not successful
b
not directly, but indirect methods like runtime.Session should work
k
can you give me an example?
b
Not really much to it
Copy code
/**
 * @NApiVersion 2.0
 * @NScriptType UserEventScript
 * @NModuleScope SameAccount
 */
define(["exports", "N/runtime"], function (exports, runtime) {
  exports.beforeLoad = function (context) {
    log.debug({
      title: "Session object myKey value",
      details: runtime.getCurrentSession().get({ name: "myKey" }),
    });
  };

  exports.afterSubmit = function (context) {
    runtime.getCurrentSession().set({
      name: "myKey",
      value: "myValue",
    });
  };
});
k
I'll give that a try, thanks!