0
votes

I am trying to pop up a Confirmation Dialog (dialog.confirm(options)) as soon as one clicks on Submit Button on my Suitelet. For this, I am using saveRecord Entrypoint in Clientscript. Below is the code

function saveRecord() {
        //alert('Inside Save Record');
        var options = {
            title: "I am a Confirmation",
            message: "Press OK or Cancel"
        };
        function success(result) {
            console.log('Success with value ' + result);
        }
        function failure(reason) {
            console.log('Failure: ' + reason);
        }
        dialog.confirm(options).then(success).catch(failure);
    }

Upon execution, I am getting the dialog box, but on clicking OK I am unable to move further. (that is from Suitelet GET to Suitelet POST).

Please Note - I am using SuiteScript 2.0

3

3 Answers

0
votes

Give the code provided when you press "Ok" there is no further actions (redirect to Suitelet) defined. If you want to trigger the Suitelet after user presses okay add the redirect to the success function. The "redirect.toSuitelet(options)" method is not available for Client scripts but you can use window.open(URL); to point the user to the suitelet.

0
votes

On saveRecord, you either return true; to proceed or return false; to stay on the page.

0
votes

If you return true from the success then it won't serve to confirm your saveRecord. It's returning from a different context. One workaround could be to use the native browser window.confirm as this executes synchronously.