How to use SharePoint ‘Working on it’ modal dialog

Ahamed Fazil Buhari
 
Senior Developer
December 1, 2017
 
Rate this article
 
Views
4883

Hello everyone,

In this article we will see how to use SharePoint’s own modal dialog wherever you want. This will be useful when we are customizing SharePoint functionality or page and if we want to show this message when some background process is running and you are waiting for that so it still feels like you are in SharePoint.

 function SP_WaitScreen() {
             SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () {
                 window.parent.eval("window.waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Working on it...', '');");
             });
         }
 
         function SP_WaitScreen_Close() {
             if (window.frameElement != null) {
                 if (window.parent.waitDialog != null) {
                     window.parent.waitDialog.close();
                 }
             }
         }
 

Call SP_WaitScreen() function before initiating your big task and the window will show the below popup. You can still customize the message if you want to,

clip_image001

Once you job is over, you call SP_WaitScreen_Close() function to close the modal popup.

 

Happy Coding

Ahamed

Author Info

Ahamed Fazil Buhari
 
Senior Developer
 
Rate this article
 
Ahamed is a Senior Developer and he has very good experience in the field of Microsoft Technologies, especially SharePoint, Azure, M365, SPFx, .NET and client side scripting - JavaScript, TypeScript, ...read more
 

Leave a comment