I'm trying to use a dialog in a `saveRecord()` is ...
# suitescript
a
I'm trying to use a dialog in a
saveRecord()
is working but the record save operation continue even if the user does not click anything...
s
Try returning false
a
I dont need to return false, It does not matter which button the user click I will save the record, however if the user does not click anything the records continue to save even with the dialog in the screen waiting for a click...
s
Thats weird!!!
j
window.confirm
freezes the main thread until you press something. this behavior is provided natively by the browser.
dialog.confirm
returns a promise. it is essentially some buttons with callbacks. the main thread does not freeze, and unless you are in an
async
function you can't wait for the result. its behavior is provided through some html and a javascript library.
it's a little complicated to use netsuite's dialog.confirm in saveRecord. you need to use a flag to detect whether the user has pressed the dialog button. return false if they have not pressed the button. when they have pressed the button and you set the flag, have your callback click the button again but this time return true.