SBX - Search With Button

SBX - Forum Post Title

Script causing error in IE

Microsoft Dynamics CRM Forum

Wayne Loring asked a question on 16 Jul 2014 2:28 PM
My Badges

Question Status

Suggested Answer

IE crashes when this script runs , yet its fine in Chrome ??

function hidetabsifdm() {
    alert("WML_Running");
    {
        if (Xrm.Page.getAttribute("im_tmdm").getText() == "TM") {
            Xrm.Page.ui.tabs.get("tab_6").sections.get("tab_6_section_5").setVisible(true);
            Xrm.Page.ui.tabs.get("tab_7").setVisible(true);
            Xrm.Page.ui.tabs.get("tab_10").setVisible(true);
            Xrm.Page.ui.tabs.get("tab_11").sections.get("tab_11_section_2").setVisible(true);
            Xrm.Page.ui.tabs.get("tab_15").setVisible(true);
            Xrm.Page.data.entity.save();
            {
                alert("Value is TM");
            }
        }
        else if (Xrm.Page.getAttribute("im_tmdm").getText() == "DM") {
            Xrm.Page.ui.tabs.get("tab_6").sections.get("tab_6_section_5").setVisible(false);
            Xrm.Page.ui.tabs.get("tab_7").setVisible(false);
            Xrm.Page.ui.tabs.get("tab_10").setVisible(false);
            Xrm.Page.ui.tabs.get("tab_11").sections.get("tab_11_section_2").setVisible(false);
            Xrm.Page.ui.tabs.get("tab_15").setVisible(false);
            Xrm.Page.data.entity.save();

            {
                 alert("Value is DM");
            }
        }
    }
}

Error :

Problem signature:

  Problem Event Name:    APPCRASH

  Application Name:    IEXPLORE.EXE

  Application Version:    11.0.9600.17207

  Application Timestamp:    53a20c50

  Fault Module Name:    MSHTML.dll

  Fault Module Version:    11.0.9600.17207

  Fault Module Timestamp:    53a22b71

  Exception Code:    c0000005

  Exception Offset:    000714a5

  OS Version:    6.1.7601.2.1.0.768.3

  Locale ID:    1033

  Additional Information 1:    0a9e

  Additional Information 2:    0a9e372d3b4ad19135b953a78882e789

  Additional Information 3:    0a9e

  Additional Information 4:    0a9e372d3b4ad19135b953a78882e789

Reply
Genya Akselrod responded on 16 Jul 2014 2:33 PM
My Badges
Suggested Answer

Hello,

Do you have any windows updates you have to install?

Do  you have any IE updates?

Thanks.

Reply
Wayne Loring responded on 16 Jul 2014 2:36 PM
My Badges

No I am current ... and I tested on multiple computers , its the same with all ... just not on Chrome

Reply
Genya Akselrod responded on 16 Jul 2014 2:53 PM
My Badges
Suggested Answer

Can you run a trace?

Reply
Wayne Loring responded on 16 Jul 2014 3:06 PM
My Badges

the script crashes IE and causes it to close, so I lose the console

Reply
Ravi Kashyap responded on 16 Jul 2014 5:29 PM

Can you verify the issue after commenting save?

eg. Xrm.Page.data.entity.save();

Reply
Wayne Loring responded on 16 Jul 2014 5:59 PM
My Badges

I have tried commenting out both saves ... and each line one at a time ... strange thing , I had it working when it was just the TAB command alone , then I added the tab and section commands and am left with the crashes ... now I revert back to what was working and it no longer works ... just crashes

Reply
Effendy Lesmana responded on 16 Jul 2014 11:05 PM
My Badges
Suggested Answer

Have you try to using IE10?

because sometimes i also got error when using IE11..

Reply
Aileen Gusni responded on 17 Jul 2014 1:45 AM
My Badges

Hi Wayne,

This seems to be IE problem.

Have you tried to restore the setting of your IE 11 to Default Settings

Hope this post might help you

social.technet.microsoft.com/.../internet-explorer-10-stopped-working-because-of-mshtmldll-appcrash

and this:

answers.microsoft.com/.../c46f678e-2a22-46dc-acfc-bac3bce1081e

Or setting the compatibility setting as well in the IE 11.

Reply
Wayne Loring responded on 17 Jul 2014 10:50 AM
My Badges

thanks for the thoughts , but I went through it all and it still crashes , including in safe mode

Reply
Ravi Kashyap responded on 17 Jul 2014 11:12 AM

Is this CRM Online or On-premise? If On-Premise, whats the rollup version?

Also, can you please let me know what do you mean by " it working when it was just the TAB command alone , then I added the tab and section commands and am left with the crashes"?

On which event this script is registered?

Reply
Wayne Loring responded on 17 Jul 2014 11:16 AM
My Badges

Online ...

TAB command alone , it worked when I only had the command to hide a tab (ONLY) then I added the command that would hide a section and it started failing ... but now it fails both ways

this is ON CHANGE event

Reply
Ravi Kashyap responded on 17 Jul 2014 2:32 PM

So I tried this same script in my test organization and it worked fine.

IE: 11.0.9600.17207

CRM Online Version: 6.1.0.1043

Do you also have script registered on onsave event?

Reply
Wayne Loring responded on 17 Jul 2014 2:39 PM
My Badges

Very frustrating for me , as I checked all versions, and they match exactly

I do not have it registered for ONSAVE

Reply
Wayne Loring responded on 17 Jul 2014 2:40 PM
My Badges

IN addition , I have 2 other scripts running on the same form using the same commands for different fields that run without issue

Reply
Ravi Kashyap responded on 18 Jul 2014 9:32 AM

This seems more tricky wherein we might need to check for that entity metadata etc. I would suggest you open a support incident with Microsoft to continue troubleshooting on the same.

let me know if you need any help in opening support incident.

- Ravi Kashyap

Reply
Genya Akselrod responded on 16 Jul 2014 2:33 PM
My Badges
Suggested Answer

Hello,

Do you have any windows updates you have to install?

Do  you have any IE updates?

Thanks.

Reply
Genya Akselrod responded on 16 Jul 2014 2:53 PM
My Badges
Suggested Answer

Can you run a trace?

Reply
Effendy Lesmana responded on 16 Jul 2014 11:05 PM
My Badges
Suggested Answer

Have you try to using IE10?

because sometimes i also got error when using IE11..

Reply
desjk responded on 17 Jun 2016 6:25 AM
Suggested Answer
Shah_ responded on 20 Jul 2016 9:42 AM
My Badges
Suggested Answer

HI,

       Can you try it using other version of IE.

Best Regards

Shah

Reply
Sandeep Mishra responded on 15 Jul 2018 8:10 AM
My Badges
Suggested Answer
jasonscript responded on 17 Jul 2018 2:30 AM
Suggested Answer

It looks like you have extra sets of  { }. Maybe IE is less "forgiving"? Try cleaning up the method and trying again

I've marked unnecessary { } in red

function hidetabsifdm() {
    alert("WML_Running");
    {
        if (Xrm.Page.getAttribute("im_tmdm").getText() == "TM") {
            Xrm.Page.ui.tabs.get("tab_6").sections.get("tab_6_section_5").setVisible(true);
            Xrm.Page.ui.tabs.get("tab_7").setVisible(true);
            Xrm.Page.ui.tabs.get("tab_10").setVisible(true);
            Xrm.Page.ui.tabs.get("tab_11").sections.get("tab_11_section_2").setVisible(true);
            Xrm.Page.ui.tabs.get("tab_15").setVisible(true);
            Xrm.Page.data.entity.save();
            {
                alert("Value is TM"); 
            }
        }
        else if (Xrm.Page.getAttribute("im_tmdm").getText() == "DM") {
            Xrm.Page.ui.tabs.get("tab_6").sections.get("tab_6_section_5").setVisible(false);
            Xrm.Page.ui.tabs.get("tab_7").setVisible(false);
            Xrm.Page.ui.tabs.get("tab_10").setVisible(false);
            Xrm.Page.ui.tabs.get("tab_11").sections.get("tab_11_section_2").setVisible(false);
            Xrm.Page.ui.tabs.get("tab_15").setVisible(false);
            Xrm.Page.data.entity.save();

            {
                 alert("Value is DM");
            }
        }
    }
}



Reply

SBX - Two Col Forum

SBX - Migrated JS