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
battk
11/06/2019, 4:16 PM
You will need to store it in a variable for later use
battk
11/06/2019, 4:17 PM
You can avoid a global by using the closure
e
ec
11/06/2019, 9:11 PM
Can't you use currentRecord.get()
ec
11/06/2019, 9:13 PM
To expound: import N/currentRecord explicitly in your define parameters, then call the above method in your function
a
Azi
11/06/2019, 9:16 PM
@ec That doesn't work in the browser. I get
currentRecord.get is not a function
. Is a client script any different?
e
ec
11/06/2019, 10:28 PM
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!