Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Unanswered

Script Error received when saving Purchase Order... Cannot read property 'length' of undefined

(0) ShareShare
ReportReport
Posted on by 15

Hello Everyone, 

I have am receiving a script error when saving a Purchase order in Dynamics 365. I reported the issue and shared the error with Microsoft. They advised me that there is custom code in our form, that is unsupported by the break-fix team. I have only used the API customization in advanced options. 

Can anyone advise what the error may be caused by, and how to fix it? The log file is pasted below. 

TypeError: Cannot read property 'length' of undefined
at Function.i.ValidateWorkOrderSchedule (xyz.dynamics.com/.../PurchaseOrder.Library.js:13:66501)
at Function.i.RunValidations (xyz.dynamics.com/.../PurchaseOrder.Library.js:13:45635)
at i.OnSave (xyz.dynamics.com/.../PurchaseOrder.Library.js:13:45874)
at Mu.executeFunction (xyz.dynamics.com/.../app.js
at xyz.dynamics.com/.../app.js
at o (xyz.dynamics.com/.../app.js
at Iu._executeIndividualEvent (xyz.dynamics.com/.../app.js
at Iu._executeEventHandler (xyz.dynamics.com/.../app.js
at Object.execute (xyz.dynamics.com/.../app.js
at O._executeSyncAction (xyz.dynamics.com/.../app.js

  • nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: Script Error received when saving Purchase Order... Cannot read property 'length' of undefined

    Moved to D365 Customer Service forum.

  • Vigsan_MS Profile Picture
    on at
    RE: Script Error received when saving Purchase Order... Cannot read property 'length' of undefined

    Hello,

    Looks like this is the customization related to Dynamics 365 customer engagement but this forum is for Dynamics 365 for finance and operations.

    Could you please repost in the customer engagement forum to get a swift support.

    Thanks

  • Pratik Jog Profile Picture
    95 on at
    RE: Script Error received when saving Purchase Order... Cannot read property 'length' of undefined

    Hi admin4media,

    As the log suggests , you are checking length of a variable which is either undefined or null , add debugger on the PurchaseOrder javascript and check where you're getting the error. If possible share the custom code written in PurchaseOrder.js and we can help. Also please mask the organization name while sharing the log in future. i.e 4media-group shouldn't be visible.  

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 51 Most Valuable Professional

#2
Ramesh Kumar Profile Picture

Ramesh Kumar 42

#3
David Shaw_UK Profile Picture

David Shaw_UK 27

Featured topics

Product updates

Dynamics 365 release plans