Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Xrm.Navigation.openConfirmDialog - Bug when called from HTML Web Resource

(0) ShareShare
ReportReport
Posted on by 242

Hi,

I have been porting an HTML Web Resource from Dynamics CRM 2013 to Dynamics CRM Online (Version 9.1.0.2048).

In the original web resource, we were using the good "old-fashioned" Javascript 'confirm' function to ask if you want to continue.

As part of the upgrade I am now using the new Xrm.Navigation.openConfirmDialog method.

When used from Javascript on Entity Forms. This method seems to work exactly as expected.

However, when I am now using it from an HTML Web Resource......

The Confirm and Cancel Buttons seem to be single blocks of colour (see the screenshot below).

Has anyone else seen this behaviour?

I have replicated it on 4 different browsers (IE 11, Edge, Chrome and Firefox) just to check it wasn't a browser specific issue.

Many Thanks,

Shaun Harvey

Capture_5F00_crop.png

*This post is locked for comments

  • Shaun W Harvey Profile Picture
    242 on at
    RE: Xrm.Navigation.openConfirmDialog - Bug when called from HTML Web Resource

    Hi,

    I do have a CSS file for this web resource.

    Removing link to the css file did not have any effect. The button labels were still blank.

    So, setting the button labels explicitly did the trick.

  • Shaun W Harvey Profile Picture
    242 on at
    RE: Xrm.Navigation.openConfirmDialog - Bug when called from HTML Web Resource

    Hi,

    Setting the button labels seems to have done the trick. Maybe the default values stated in the documentation don't render when called from an HTML Web Resource.

    Thanks for your help!

    Shaun

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Xrm.Navigation.openConfirmDialog - Bug when called from HTML Web Resource

    Hi Shaun,

    What I understand the problem might be related to your HTML . Do you have any kind of default  CSS  apply in the HTML web resource ?

    Can you try with blank html and see its showing or not . In addition you can please compare the difference (when open from the form and open from the html webresource ) of the CSS by checking browser F12 window selector. See which additional CSS applied in that case.

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: Xrm.Navigation.openConfirmDialog - Bug when called from HTML Web Resource

    Hi,

    After i removed the CancelButtonLabel and confirmButtonLabel, it is working as expected.

    8154.26.PNG

    if after you provided the CancelButtonLabel and confirmButtonLabel and still not working. 

    1. ) try update the browser version 

      - i am using Version 71.0.3578.98 ( Google Chrome)

    2.) Clear all caches.

    If nothing is work, I think most probably you should contact Microsoft.

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: Xrm.Navigation.openConfirmDialog - Bug when called from HTML Web Resource

    Hi,

    I tested in my environment.

    0407.25.PNG

    Try to provide the cancelButtonLabel and confirmButtonLabel. Although the msdn article stated that , it default to Ok and Cancel if nothing is provided. But lets try.

    function opendialog()
    {
    var confirmStrings = { text:"This is a confirmation.", title:"Confirmation Dialog",cancelButtonLabel:"Cancel", confirmButtonLabel:"Open" };
    var confirmOptions = { height: 200, width: 450 };
    Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
    function (success) {
    if (success.confirmed)
    console.log("Dialog closed using OK button.");
    else
    console.log("Dialog closed using Cancel button or X.");
    });
    }

  • Shaun W Harvey Profile Picture
    242 on at
    RE: Xrm.Navigation.openConfirmDialog - Bug when called from HTML Web Resource

    Here is the area in question.

    So, it is javascript within the HTML Web Resource.

    We have some if statements to determine the actual text to display and then the call to openConfirmDialog() itself.

                   if (self.Mode() == "Create") {

                       confirmText = "You are about to create Credit Note(s). Do you wish to proceed?";

                       confirmTitle = "Create Credit Notes";

                   }

                   else if (self.Mode() == "Approve") {

                       confirmText = "You are about to approve Credit Note(s). Do you wish to proceed?";

                       confirmTitle = "Approve Credit Notes";

                   }

                   var confirmStrings = { text: confirmText, title: confirmTitle };

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

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

                       function (success) {

  • Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: Xrm.Navigation.openConfirmDialog - Bug when called from HTML Web Resource

    Hi,

    can you share your code?

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans