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

Robbie
Kilo Patron
Kilo Patron

Hi @sreekeerthi,

 

I've found that David McDonald's (Kudos) blog around GlideModal a great help in the past. Check the below.

(David - I tried to tag you and give you the deserved kudos but I'm not sure of your handle... I checked a few peeps with the same name but they clearly weren't you).

 

https://davidmac.pro/posts/2022-02-08-glidemodal/

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.




Thanks, Robbie

Ankur Bawiskar
Tera Patron
Tera Patron

@sreekeerthi 

please share your complete scripts.

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 ,

 

Please find below scripts in the UI Page:

Client script in UI Page:

function continueOK() {
    //alert("OK clicked");

    var gdw = GlideDialogWindow.get();

    var not = gel('my_qcpc_notes').value;
	if (not=="")
  {
	alert("Please enter QCPC Notes");
  return false;
}
    var hrcase_no = gdw.getPreference('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();
}
function continueCancel() {
    //alert("Cancel clicked");
    GlideDialogWindow.get().destroy();
}

 

Processing script:

var user = request.getParameter("user_ref"); //mention the name of the elment here
// var my_name = request.getParameter("my_name"); //mention the name of the elment here
var not = request.getParameter("my_qcpc_notes");

 

and OnChange Client Script is:

 

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 GlideDialogWindow('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  
    }
}

 

We created fields on the table and we are mapping them with the fields on the popup. Please help us in fixing the issue where we are unable to store any values in that field.

 

Thank You!

@sreekeerthi 

so you are sending value from UI action to UI page but UI page can't receive those and can't show?

Is that your question?

If yes then share your HTML script as well

Was this working fine earlier?

where are you testing this? native or workspace?

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