Glide Modal Pop-up on Onload Client Script

Vinicius Luz1
Tera Expert

have a code in a  client script On load

function onLoad() {

 

    var category = g_form.getValue('category');

    var qaTestingRes = g_form.getValue('u_qa_testing_result');

 

    if (category == 'Software Applications' && qaTestingRes == 'pass') {

 

        var gm = new GlideModal('acknowledgement');

        gm.setTitle('Email attachment reminder');

 

        gm.renderWithContent('<div style="padding:15px"><p>Have you attached the email from the QA/UAT Tester approving the change to deploy to production?</p><button style="padding:5px; margin:3px" class="btn btn-primary" onclick="ack(this.innerHTML)">OK</button><button style="padding:5px; margin:3px" class="btn btn-primary" onclick="ack(this.innerHTML)">Cancel</button></div>');

 

 

    }

 

 

    function ack(thisButton) {

        console.log('vinilogs calling action');

        gm.destroy();

        if (thisButton == 'OK') {

            g_form.addInfoMessage("Do something");

        }

    }

 

}


When I hit the button, the console says ACK is not a function, how can I avoid this error?

1 ACCEPTED SOLUTION

Vanderlei
Mega Sage

Hello @Vinicius Luz1 , how are you?

You could try to go a more OOTB route and use this article as a basis to make this functionality.

 

Vanderlei_0-1697468479754.png

 

function onLoad() {

    var category = g_form.getValue('category'),

    qaTestingRes = g_form.getValue('u_qa_testing_result');

    if (category == 'Software Applications' && qaTestingRes == 'pass') {
       var gm = new GlideModal("glide_confirm_basic", true, 600);
      gm.setTitle("Email attachment reminder");
      gm.setPreference("title", "Have you attached the email from the QA/UAT Tester approving the change to deploy to production?");
      gm.setPreference("onPromptComplete", function() {alert("You clicked on 'Ok'")});
      gm.setPreference("onPromptCancel", function() {alert("You clicked on 'Cancel'")});
      gm.render();
    }

}

If my answer helped you, please mark my answer as helpful.

 

Vanderlei Catione Junior | LinkedIn

Senior ServicePortal Developer / TechLead at The Cloud People

View solution in original post

2 REPLIES 2

Vanderlei
Mega Sage

Hello @Vinicius Luz1 , how are you?

You could try to go a more OOTB route and use this article as a basis to make this functionality.

 

Vanderlei_0-1697468479754.png

 

function onLoad() {

    var category = g_form.getValue('category'),

    qaTestingRes = g_form.getValue('u_qa_testing_result');

    if (category == 'Software Applications' && qaTestingRes == 'pass') {
       var gm = new GlideModal("glide_confirm_basic", true, 600);
      gm.setTitle("Email attachment reminder");
      gm.setPreference("title", "Have you attached the email from the QA/UAT Tester approving the change to deploy to production?");
      gm.setPreference("onPromptComplete", function() {alert("You clicked on 'Ok'")});
      gm.setPreference("onPromptCancel", function() {alert("You clicked on 'Cancel'")});
      gm.render();
    }

}

If my answer helped you, please mark my answer as helpful.

 

Vanderlei Catione Junior | LinkedIn

Senior ServicePortal Developer / TechLead at The Cloud People

J_47
Tera Contributor

I am trying to use the same code inside onSubmit Client Script but its not working