Dialog Window Closure Event

Andrii
Kilo Guru

Hi,

I'm displaying dialog window with UI Page content. I want to handle event when users presses closing cross on the dialog.

Any ideas?

1 ACCEPTED SOLUTION

Yes, I've used:


window.addEventListener('beforeunload',function() {});


View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Andrii,



I don't think you can perform any check on click of cross icon for dialog.


In the client script you can add the below code



getDialogBox();



the code within this function is as belows:


  function getDialogBox()


  {


    showLoadingDialog();


    Event.observe(window, 'load', function(){


      hideLoadingDialog();


    });


  }



What it does is:


1) Displays dialog window


2) Observes the event and once the processing is completed it automatically closed the dialog window



Also this might be helpful GlideDialogWindow: Advanced Popups Using UI Pages - ServiceNow Guru



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Andrii,



Any update on this? Can you mark my answer as correct, helpful and hit like if you were able to achieve your requirement. This helps in removing this question from unanswered list. Thanks in advance.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Yes, I've used:


window.addEventListener('beforeunload',function() {});