Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Script Error

(0) ShareShare
ReportReport
Posted on by

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
    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
    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
    13,758 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
    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
    13,758 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
    on at
    RE: Script Error

    This is what i get when watching the loading log.

    8130.Capturar.PNG

  • Community Member Profile Picture
    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
    13,758 on at
  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 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

🌸 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
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans