How can I replace GlideDialogWindow.get().destroy(); in the Client Script for a UI Page?

SebCastro
Tera Contributor

I have been building a UI Page to capture simple comments as Notes, and When checking examples for the Ok and Cancel button, I am using something like this 

 

function continueCancel() {
    GlideDialogWindow.get().destroy();//Cancel if necesseray
}
 
But while reading about GlideDialogWindows has been deprecated. So my question is how do you do this using GlideModalV3
 
 
But checking the information I cannot see the equivalent of the destroy()
 
I appreciate any help you can provide. 
2 REPLIES 2

Murthy Ch
Giga Sage

@SebCastro 

You can try something like below for OK and Cancel scenario:

var dialog = new GlideModal('glide_modal_confirm', true, 400);
dialog.setTitle(new GwtMessage().getMessage('Title'));
dialog.setPreference('body', new GwtMessage().getMessage("Do you want to continue?"));
dialog.setPreference('buttonLabelComplete', new GwtMessage().getMessage('Yes'));
dialog.setPreference('buttonLabelCancel', new GwtMessage().getMessage('Cancel'));
dialog.setPreference('onPromptComplete', onConfirm); //call function
dialog.setPreference('onPromptCancel', onCancel); //call function
dialog.render();

function onConfirm() {
    saveAndClose = true;
}

function onCancel() {
    saveAndClose = false;
}

(=tested)

 

Thanks,
Murthy

It is unclear to me where this script should be used, since with the GlideDialogWindow.get().destroy(); I will use it on the UI Page Client Script and assign functions to the buttons including the GlideDialogWindow.get().destroy();, I tried to set up your script in many ways and could not make the buttons work.