What is Issue?
While using openConfirmDialog in Xrm, you will be always able write the logic according to ok and cancel button. But some times ‘x’ button will get ignored while development and which will results into code loophole. Also there might be situation when you have to write different logic on ‘x’ and ‘cancel’ button. So how to get the ‘x’ button event?
Microsoft has provided the documentation for openConfirmDialog () with ok and cancel button description. But might be forget to write about ‘x’ button or might be they functionality was inprogress while it was documented.
If you know ,you can write success callback and error callback function to openConfirmDialog ().then(success(),error());
Success callback function holds the response from user, whether he confirmed or canceled this action. Using same function we can handle ‘x’ button event.
The user response to the confirmation as below-
- Press Ok : success.confirmed
- Press Cancel: success.confirmed
- Press ‘x’ : success.confirmed
So in success callback function, use proper conditions to handle logics on these buttons available on openConfirmDialog.
Now according to above code, if I press ‘x’ the result will be as below-
Hope this will help…
Enjoy Ms CRM!!!