Replacing GlideDialogWindow with GlideModal is not working

sreekeerthi
Tera Contributor

Hi Team,

 

We used "GlideDialogWindow" in a UI Page and Client script to fetch values of fields from a dialog box. But we recently started facing issue with all these fields on the dialog box. These fields no more capture any value and store in the table. We suspect it is because "GlideDialogWindow" is deprecated in ServiceNow. We tried to use "GlideModal" API but it is not getting defined in the system. Can someone help us know how to use "GlideModal" in Servicenow as we are unable to replace it and fix the the issue.

 

Thank you in advance!

 

2 ACCEPTED SOLUTIONS

@sreekeerthi 

Did my response worked for the UI page logic?

I believe your original question was to replace GlideDialog with GlideModal and you were not able to achieve it.

I provided answer to it.

Next part you can debug from your side why the update is not allowed.

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

View solution in original post

@sreekeerthi 

the OOB business rule is getting satisfied during the update and blocking

please debug the business rule

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

View solution in original post

17 REPLIES 17

@Ankur Bawiskar , Please find the html code below:

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
    
     <g:ui_form>
    <table>
        
        <tr>
                    <td style="width:60%">
                      <input type="text" name="my_qcpc_notes" id="my_qcpc_notes" table="sn_hr_core_case" mandatory="true"   field="u_qcpc_qcpc_notes" query="active=true"/>
                    </td>
                </tr>
        <tr>
                     <td>
                       <g:dialog_buttons_ok_cancel ok_id="submitData" ok="return continueOK()" ok_type="button" ok_text="${gs.getMessage('Ok')}" ok_style_class="btn btn-primary" cancel_type="button" cancel_id="cancelData" cancel_style_class="btn btn-default" cancel="return continueCancel()"/>
                    </td>
               </tr>
    </table>
    </g:ui_form>
</j:jelly>

 

This was working completely fine before. We were using this since 2021 and we started facing issue from Jan 2025. Our instance is upgraded to Patch 9 Washington version and not sure if this is the issue.

 

Additionaly, when we are trying to submit the value on the form it started throwing an error 

"Selected document template has an incompatible document template category specified." which is happening because of an OOB BR called "Doc template and category validation". This BR should only trigger if the Document template and Document template category values are not empty. In our case, these fields are empty even though this BR is triggering.
 
I reached out Servicenow Hi Team, but they were unable to troubleshoot the issue, they mentioned that "GlideDialogWindow" is depracted in ServiceNow and should be replaced with GlideModal.

@sreekeerthi 

just because it's deprecated it doesn't mean it should be replaced, that's not what they should respond.

there are lot of OOB UI Actions where you will find GlideModal and how the value is passed from UI action to UI page

How do I pass values to UI Page with glideModal? 

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

@sreekeerthi 

try this

Client script:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {

        return;

    }
    if (g_form.getValue('u_qcpc') == 'Escape' || g_form.getValue('u_qcpc') == 'Turnback') {

        var dialog = new GlideModal('sn_hr_core_QCPC Dialog');
        dialog.setTitle('QCPC Dialog'); //Set the dialog title
        dialog.setSize(500, 5000); //Set the dialog size
        //         dialog.setPreference('my_source', g_form.getUniqueValue()); //pass current object id
        //         dialog.setPreference('value', newValue); //pass the selected value on the form	
        dialog.setPreference('case_no', g_form.getValue("number"));
        dialog.render(); //Open the dialog  
    }
}

UI Page

Client Script:

function continueOK() {

    var not = gel('my_qcpc_notes').value;
    if (not == "") {
        alert("Please enter QCPC Notes");
        return false;
    }
    var hrcase_no = GlideModal.prototype.get('case_no');
    var record = new GlideRecord('sn_hr_core_case');
    record.addQuery('number', hrcase_no);
    record.query();
    if (record.next()) {
        record.u_qcpc_qcpc_notes = not;
        record.update();
    }

    GlideDialogWindow.get().destroy();
}

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

sreekeerthi
Tera Contributor

Hi @Robbie ,

 

Thank you for the link provided! I will go through this. 

sreekeerthi
Tera Contributor

@Ankur Bawiskar ,

 

I tried the scripts. The error stopped showing up but the field still didn't capture any value. One thing I observed while using GlideModal is it's not getting defined in the scripts. Please find the attached screenshot. There is a difference when we call GlideDialogWindow and GlideModal. Why is this happening this way. Is this the reason why the scripts are not working. Am I missing something? Please help me understand this. 

 

sreekeerthi_0-1740654593208.png