Skip to main content
Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
Answered

Error with Fields Customized Event

(0) ShareShare
ReportReport
Posted on by 63

I've been getting an error when I open my Website Information in Dynamics 365 Portals. The Error is attached but it says the following:

 

There was an error with this field's customized event.

Field:window

Event:onload

Error:Unable to get property 'length' of undefined or null reference

 

I was able to find the window.onload function in the Header Template source, however there is no call to get the length property (Screenshot of this code is also provided). I've changed some code in other places but have not touched this. I also tried reverting all of my changes to see where this issue occurred but it persisted no matter what I changed.


I don't understand what's going wrong here and have no idea how to move forward with fixing it. Any help would be appreciated!

  • Verified answer
    JonahPincetich Profile Picture
    63 on at
    Re: Error with Fields Customized Event

    I know I'm just talking to myself here but someone at some point will find this useful.

     

    This is an issue when accessing the site through my companies CRM/Dynamics 365, but it is not an issue when I go through the PowerApps app "Dynamics 365 Portals".

  • JonahPincetich Profile Picture
    63 on at
    Re: Error with Fields Customized Event

    Discovered this does not fix the problem but instead only silences the alert.

     

    Becuase of this issue I know of two things that cannot be done:

    Load the iFrames of an Entity List

    Add a language to the Portal

     

    Both of these resources seem to use the length property at some point and fail because it's null. I was able to discover this using the inspect tool on chrome.

     

    Does anyone know how to fix this? Where is this value from?

  • JonahPincetich Profile Picture
    63 on at
    Re: Error with Fields Customized Event

    Well, I was able to fix it with help from this forum post: Link 

     

    TL;DR:

    I went to the Website Form Editor (Found in the ellipses at the top of the screen).

    Clicked on Form Properties in the top ribbon

    At the bottom chose Control: Form and Event OnLoad

    Selected the on one Library item in this selection, and selected Edit Library

    Found that length was from an options variable which was being used in this for loop:  for (var i = 0; i < options.length; i++) { ... }
    I added a check around this loop: if (options != null) { for (var i = 0; i < options.length; i++) { ... } }

    Error fixed!!

     

    Still not sure what I did to cause this error so if anyone has any insight into what would cause this please leave a comment! Hope this helps someone else!

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork 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 > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35