This message was deleted.
# suitescript
s
This message was deleted.
b
easiest is using confirm
its ugly but is synchronous, which allows you to choose between returning true or false
p
Thank you for replying, so can you help me understand what I need to do differently? As you can see in my script I used dialog.confirm
b
the return value of the saveRecord performs a function
p
and how do I get a true return value from clicking OK and a false return value from clicking Cancel?
b
have you gone through the confirm documentation i linked
p
aha sorry, I didn't click on it, will read it now
ok, I read both links but I still don't see how I am to get the return values... if I remove the "return true;" from my script then the dialog box has no effect
b
confirm returns true or false
return that value
p
ok, and how would I do that?
b
thats a very basic javscript question
p
yes, I am fairly new to this, ramping up quickly
b
its likely that you need to finish learning how to use javascript before trying this
p
yup, all is in process, just looking for a quick pointer in the right direction
maybe something like this? saveRecord: (context) => { let clickBox = { title: 'Please Confirm', message: 'Click OK if everything looks good. Click Cancel to go back and make corrections.' }; dialog.confirm(clickBox); return clickBox; } }
b
thats not using confirm
p
how it is not? I have dialog.confirm()
b
Window.confirm is not the same as dialog.confirm
even if it was, your code does not use its return value
p
I am using SuiteScript
using the N/ui/dialog module
b
learn javascript first so you can tell the difference between suitescript
p
how do you think people learn, friend?
b
recognize that im telling you not to use dialog.confirm
p
recognize that I must use it
can you not explain how to use it correctly?
cheers mate, enjoy the rest of your day
b
you dont want to use dialog.comfirm because you cant use it with the saveRecord entry point, its returns an asynchronous promise, which means the saveRecord must have already returned a value
its guaranteed to be too late
p
ok, that makes sense
b
so you have to manually trigger the save again, which is not a function that suitescript makes available, you would have to use javascript to manipulate the dom
p
ok, so I guess I need to rethink my approach, because I have limited parameters
I must use N/ui/dialog and I must create a confirm dialog that is required to submit an expense report
and so you're saying it's not possible without manipulating the dom... ok, thank you for the information