How to close GlideModal window on click of submit button.

Abhijit4
Mega Sage

Hello Experts,

I am opening UI page on click of UI action with GlideModal class. I just want to close that page on click of submit button(after performing some operation). Seems GlideDialogWinow.get().destroy() doesnt work. 

Any help would be appreciated.

Thanks in advance.

 

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

8 REPLIES 8

Azim Kazi
Giga Guru

Hi Cody,

 

It's because you are destroying your GlideModal before you are returning true. You don't need to do this if you are using the processing script, you just need to use the response.sendRedirect([URL]) to put the user where you want them to be after they've submitted your page, the GlideModal will automatically be destroyed. Alternatively you could use a GlideAjax call in your client script to call the server side processing.

 

OR take reference from script given below

 

This client-side function gets called either after the server-side update has completed and records are reassigned or the Cancel button is pressed.

c.closeModal = function() {
c.modalInstance.close();
spUtil.update($scope);
};

 

Mark helpful/correct based on impact.

 

Regards

Ajim.

Hi Ajim,

Thaks for your reply.

I am not using processing script(cannot use due to requirement restriction) so the first part will not work for me.

 

I am trying to understand your second solution, can you please explain what is 'c' object there because it is giving me an error  c is not defined.

 

Thanks.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

Hi Cody,

if that is not working have look at this link then :https://community.servicenow.com/community?id=community_question&sys_id=904e4111db539380b2102926ca96...

 

find second answer of @xiaix 

Hi Ajim,

I already tried that solution but no luck.

Thanks.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP