DEVload-prog
DEVload-prog

Reputation: 1

Swal alerts not returning value's in netsuite client script in saverecord function of suitescript 2.0

The code below is a saverecord function in netsuite which needs to get OK or CANCEL button having true or false value to submit the suitelet.

function saveRecord()
{
    swal({
        title: "Are you sure?",
        text: message,
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "Yes",
        cancelButtonText: "No",
        closeOnConfirm: false,
        closeOnCancel: false
    },
    function(isConfirm){
        if (isConfirm) {
            return true;
        } else {
            return false;
        }
    });

}

Upvotes: 0

Views: 394

Answers (1)

erictgrubaugh
erictgrubaugh

Reputation: 8857

First, you'll need to return a value from your saveRecord function.

While I haven't used swal specifically, my guess would be that the callback method is invoked asynchronously. You'll have a tough time getting an async dialog to work in conjunction with saveRecord.

Upvotes: 0

Related Questions