web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

On clicking of Esc button for Xrm.Navigation.openAlertDialog goes to success call back .

(0) ShareShare
ReportReport
Posted on by 350

I have scenario to show alert dialog and on click of OK should navigate to view in CRM .

For this I have used Xrm.Navigation.openAlertDialog everything works good when I click on OK it navigates to view but on click of Esc or Close(X) button it again showing the same behavior as OK button like Opening the view which is causing infinite loop .

Presently I have used Window.open to open different page for entity View but similar thing is happening when I press Close button for Xrm.Navigation.navigateTo method also .

I have used the same code as mentioned below ..

var alertStrings = { confirmButtonLabel: "Yes", text: "This is an alert.", title: "Sample title" };
var alertOptions = { height: 120, width: 260 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
    function (success) {
        window.open("----THIS WILL HAVE VIEW "----);
    },
    function (error) {
        console.log(error.message);
    }
);

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    You should try openConfirmDialog instead - docs.microsoft.com/.../openconfirmdialog

  • Sai Chaitanya Profile Picture
    350 on at

    Thanks But I have specific requirement to show Alert message but even tried openConfirmDialog when I use X button or ESC to close the same behavior happens like navigating to View ...

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    I'm afraid you would not be able to use alert for your scenario. Can you please provide the code that you used with openConfirmDialog that doesn't work?

  • Sai Chaitanya Profile Picture
    350 on at

    Here is the code

    var confirmStrings = { text:"Please close appointments", title:"Open Appointments" };

    var confirmOptions = { height: 200, width: 450 };

    Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(

    function (success) {    

       if (success.confirmed)

          window.open("MY VIEW URL");

       else

    });

    I dont have much use of this one but pretty much confused why clicking on X mark to close dialog still opens up my View in using Window.open...

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Your code looks ok for me but just in case try to use the following code instead:

    var confirmStrings = { text:"Please close appointments", title:"Open Appointments" };

    var confirmOptions = { height: 200, width: 450 };

    Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(

    function (success) {    

      if (success.confirmed) {

         window.open("MY VIEW URL");

      }

    });

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 143 Super User 2026 Season 1

#2
Hamza H Profile Picture

Hamza H 142 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 121

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans