What do you mean by submit without touching the do...
# suitescript
s
What do you mean by submit without touching the dom? You can submit the record with record.save()?
m
save() isnt a function on currentRecord. I want to prompt the user a notification onSave and allow them to click yes or no to save, therefore i need be able to hit submit for them.
a
i think if you return true in onSave it saves the record, and returning false just returns them to the record page. does that not work for your scenario?
m
You could use window.confirm which is synchronous but I'm guessing you want something prettier? Until NetSuite either allows returning a promise to onSave or an API to submit you have to use JS to click the button yourself.
m
Thanks michoel. I never had to do something like this. Figured maybe there was some undocumented way of saving using the currentRecord api but will just use the window to submit the form
@amy I want to prompt the user if they want to save with a yes or no button. The prompt returns a promise and as michoel pointed out, you must return true or false from the onSave function
s
The safest way is to use window.confirm, but if you really want to use N/ui/dialog promise, then you need to return false in your onSave function and submit the form when your promise resolves using JavaScript. I have used document.getElementsByName('main_form')[0].submit() but DOM manipulation is risky and you should be prepared to update your code if NetSuite changes their DOM structure in any future release.