Hi All,
is anybody knows if it possible to use dialog.confirm (from 'N/ui/dialog' module) in saveRecord (clientscript) function?
I`m using for a now JS build in 'confirm' function in order to get user response for particular situation.
From what I found the design of confirm box cannot be changed (number of buttons, name for buttons etc....).
I found module in suitescript that provides more flexible confirm box, but the problem is it return promise object (instead boaleen in standard JS confirm function) and not stop the code running.
My code is something like this:
define(['N/ui/dialog'], function (dialog) {
/**
*@NApiVersion 2.1
*@NScriptType ClientScript
*/
function saveRecord(context) {debugger
options = {title: 'I am an Alert',message: 'Click OK to continue.'};
function success(result) {return true};
function failure(reason) {return false};
var k=dialog.confirm(options).then(success).catch(failure)
return k
}
The big problem is message box appears only after save function is already executed, what makes it useless. The code doesn`t wain for user response.