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

@sreekeerthi 

check any OOB UI page in scoped app which uses GlideModal and how it's passing the parameter value using setPreference

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 

Hope you are doing good.

Did my reply answer your question?

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

Hi @Ankur Bawiskar ,

 

I checked all OOB Scripts and changed the scripts accordingly but the issue is still there. I added logs and found that the script is breaking at the below line:

 

 var hrcase_no = GlideModal.prototype.get('case_no');

It is not fetching the value from client script to UI Page. Can you please help on this.

 

Thank you!

 

@sreekeerthi 

I was able to pass value and get using this syntax

So please do this

HTML:

<?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>
	 <g:evaluate var="sysparm_number" expression="RP.getWindowProperties().case_no"/>
	 <input type="hidden" id="casenumber" value="${sysparm_number}"/>
    <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>

Client Script:

function continueOK() {

    var not = gel('my_qcpc_notes').value;
    if (not == "") {
        alert("Please enter QCPC Notes");
        return false;
    }
    var hrcase_no = gel('casenumber').value;
    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();
}

Working Solution: I got the case number in HTML side and the same can be accessed in client script

modal.gif

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 @Ankur Bawiskar ,

 

Now it's showing the error again. The error says "Selected document template has an incompatible document template category specified." which is coming from "Doc template and category validation" OOB BR. Not sure why this script is aborting the action on the UI Page.