I am trying to access the currentRecord mode type ...
# suitescript
a
I am trying to access the currentRecord mode type in a client script. I see on pageInit you have access to context.mode, but I need it in the saveRecord. Is there a way to directly access it in the saveRecord? I could set a global variable from the page init, but I feel this is hacky.
b
You will need to store it in a variable for later use
You can avoid a global by using the closure
e
Can't you use currentRecord.get()
To expound: import N/currentRecord explicitly in your define parameters, then call the above method in your function
a
@ec That doesn't work in the browser. I get
currentRecord.get is not a function
. Is a client script any different?
e
In the browser console you'll have to be in edit mode of a record, as a require (['N/currentRecord'], function(currentRecord) {} but I'm on the cell so that may not be totally syntactically correct!