<@UHQFWH30Q> I don't believe there is anything off...
# suitescript
m
@David Durst I don't believe there is anything officially exposed in the API but NS definitely tracks it (as evident from the "This record has not changed, are you sure you want to submit" popups) and I wouldn't be surprised if they just use a global variable. It would also be pretty simple to track it yourself
d
I am trying to avoid putting a custom field if I don't have to.
m
You could keep a variable outside of your entry points
d
yeah, I know I can create a field thats not saved and don't display it on the form. (Just hoping that there was a elegant method already in place.)
m
I think you could use a module scoped variable (i.e. declared outside of the entry points)
d
Was unaware there was such a thing, do you have a link to a good tutorial?
I am not natively a JS/SS programmer, I would know how to keep a var in scope in something like Python/C etc... but in JS I am not sure how it all works client side
m
I'm on mobile but something like
Copy code
define([], function() {
  var dirty = false;

  return {
    fieldChanged: function(context) {
       dirty = true;
    },
    saveRecord: function(context) {
       if(dirty) {
          // record has changed
       }
    }
  }
});