locked
confirmDialog Bug in Dynamics CRM 2013 RRS feed

  • Question

  • All,

    There seems to be an issue with the confirmDialogue function in Dynamics CRM 2013 in that it crashes the browser (Firefox, Internet Explorer 11).  When debugging the application, Visual Studio shows a message stating "Unhandled exception at 0x6961969C (mshtml.dll) in iexplore.exe: 0xC0000005: Access violation reading location 0x00000024." and when breaking on this error I get a mshtml.pdb not loaded.  To implement the confirmDialogue, I use the following code:

    function saveRecordOnClearanceLevelChange() {
        var clearanceLevel = Xrm.Page.getAttribute("cats_clearancelevel").getText();
        if (clearanceLevel == "Top Secret") {
            var userRoleIds = Xrm.Page.context.getUserRoles();
            var hasClearance = checkClearance(userRoleIds);
            var message = "You do not have permission to view Top Secret records, are you sure you want to continue?";
    
            if (hasClearance == false) {
                //closeForm();
                Xrm.Utility.confirmDialog(message, closeForm, setFocus);
            }
        }
    }
    
    function checkClearance(userRoleIds) {
        var hasClearance = false;
        var clearanceLevel = Xrm.Page.getAttribute("cats_clearancelevel").getText();
    
        for (var x = 0; x < userRoleIds.length; x++) {
            if (clearanceLevel == "Top Secret" && userRoleIds[x] == "6924e225-2d90-e311-9408-00155dc8110b") {
                hasClearance = true;
                break;
            }
        }
        return hasClearance;
    }
    
    function closeForm() {
    
        Xrm.Page.data.entity.save("saveandclose");
    
    }
    
    function setFocus() {
        Xrm.Page.getControl("cats_clearancelevel").setFocus();
    }
    Any idea on why this block of JavaScript might be crashing these browsers?

    Wednesday, May 7, 2014 3:05 PM