Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Script Error

Posted on by Microsoft Employee

Hello,

I'm having some trouble with CRM Dynamics 365. When oppening an opportunitty (creating a new one, or accessing an existing opportunity), I'm allways receiving the following message:

"Script Error
One of the scripts for this record has caused an error. For more details, download the log file.
TypeError: Cannot read property 'opportunity' of undefined at eval (eval at RunHandlerInternal (stratioautomotive.crm4.dynamics.com/.../ClientApiWrapper.aspx), <anonymous>:1:9)"

The only plugin I've incorporated in my CRM is adx for deploying partner portals.

Any thoughts on how can I solve this script error?


The log Files presents the following information:

TypeError: Cannot read property 'opportunity' of undefined
at eval (eval at RunHandlerInternal (stratioautomotive.crm4.dynamics.com/.../ClientApiWrapper.aspx), <anonymous>:1:9)
at RunHandlerInternal (stratioautomotive.crm4.dynamics.com/.../ClientApiWrapper.aspx)
at RunHandlers (stratioautomotive.crm4.dynamics.com/.../ClientApiWrapper.aspx)
at OnScriptTagLoaded (stratioautomotive.crm4.dynamics.com/.../ClientApiWrapper.aspx)
at stratioautomotive.crm4.dynamics.com/.../ClientApiWrapper.aspx


Thanks in advance.

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Script Error

    Ok, back to the basics.

    Just Tryed with IE and Edge Browser... The problem seems to only appear in Chrome....

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Script Error

    in all of them, the library is beeing called "Opportunity_main_system_library.js"

    But i've found something that doesn't appear quite right to me:

    <clientresources>
                    <internalresources>
                      <clientincludes>
                        <internaljscriptfile src="/_static/sfa/sfautil.js" />
                        <internaljscriptfile src="/_static/sfa/opps/opps.js" />
                        <internaljscriptfile src="/_static/sfa/quotes/qoi_script.js" />
                        <internaljscriptfile src="$webresource:Opportunity_main_system_library.js" />
                      </clientincludes>


  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Script Error

    Yes - these will be there multiple times.

    you have to look for the one where opportunity function is being called as mentioned in your error.

    so mainlibrary."Opportunity" look for this in the internal handler tags & just comment out that internal handlers and import back the solution.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Script Error

    I'm not shure what i'm looking for, but with the information i found these part of the code multiple times.

    How can i solve this??

    <event name="onload" application="true" active="true">
    <InternalHandlers>
    <Handler functionName="Mscrm.Form_onload" libraryName="Opportunity_main_system_library.js" handlerUniqueId="228e5887-18c6-4d90-8d6e-bae09af2d977" enabled="true">
    <dependencies>
    <dependency id="estimatedvalue" />
    <dependency id="isrevenuesystemcalculated" />
    </dependencies>
    </Handler>
    </InternalHandlers>
    </event>


  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Script Error

    Hi Diogo,

    You have to look for something like below in form xmls :

    In my example it was “form_onload” but in your case its “opportunity” which is attached to internalhandler.

    Also please take a solution backup.

    <!–<InternalHandlers>

                       <Handler functionName=”Mscrm.ContactMainSystemLibraryWebResource.Opportunity” libraryName=”Contact_main_system_library.js” handlerUniqueId=”4ea24ebd-795d-434e-af94-6812c3867b54″ enabled=”true” />

                     </InternalHandlers> –>

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Script Error

    This is what i get when watching the loading log.

    8130.Capturar.PNG

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Script Error

    Thanks for the answer Rawish.

    I've created the solution for the entity "opportunity" with all the forms attached.

    After exporting, I've search in the xml for the reference "ClientApiWrapper.aspx" and found no reference...

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Script Error

    Hi Diogo,

    This error is very specific to Client side not server so plugin will not be factor here.

    Please check by going to form editor if there are any scripts attached to the form?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans