The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Yes button not working on glide model popup

pathumharsh
Mega Contributor

pathumharsh_0-1758613440558.png

In my custom table, there is a check box, 
when the form loads, I have configured this popup when form loads,  if any user clicked the yes button, the checkbox should be make true, but its not working , how can i do that?

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@pathumharsh 

sorry but you didn't share code.

Share the code, screenshots and script etc

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

function onLoad() {
    var consultation = g_form.getValue('u_consultation');

 

    if (consultation == 'false') {
        var dialog = new GlideDialogWindow('');
        dialog.setTitle("Free Consultation Offer");

 

        var html = "<div style='padding:15px; font-size:14px;'>" +
                   "<p>This account has an active VAR contract. Would you like to offer a free 1-hour consultation?</p>" +
                   "<button class='btn btn-primary' onclick='acceptConsultation()'>Yes</button> " +
                   "<button class='btn btn-default' onclick='cancelConsultation()'>No</button>" +
                   "</div>";

 

        dialog.setBody(html, false, false);
        dialog.render();
    }
}

 

 
function acceptConsultation() {
    g_form.setValue('u_consultation', true);
    var dlg = GlideDialogWindow.get();
    if (dlg) dlg.destroy();
}

 

 
function cancelConsultation() {
    var dlg = GlideDialogWindow.get();
    if (dlg) dlg.destroy();
}



this is the code i have used