7
var waitingDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Your action is in progress...', "Please wait while we generate the tasks for you.");

error

Unable to get property showWaitScreenWithNoClose of undefined or null reference

I keep getting this error message, how do I fix this?

Atish Kumar Dipongkor
  • 13,371
  • 5
  • 32
  • 64
Khalifa Sabt
  • 111
  • 3
  • 13

1 Answers1

12

It seems you are missing SP.SOD.executeFunc. Try following.

SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function() {
    var waitingDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Your action is in progress...', "Please wait while we generate the tasks for you.");
});

I have tried it and output is following

enter image description here

Reason

SP.UI.ModalDialog execution must be delayed until sp.js and SP.ClientContext are loaded.

Atish Kumar Dipongkor
  • 13,371
  • 5
  • 32
  • 64