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 :
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

I have the same question (0)
  • Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    can you share your code?

  • Shaun W Harvey Profile Picture
    242 on at

    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) {

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    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.");
    });
    }

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    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.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    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.

  • Shaun W Harvey Profile Picture
    242 on at

    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

  • Shaun W Harvey Profile Picture
    242 on at

    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.

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 Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans