web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Error when creating a new record for javascript code

(0) ShareShare
ReportReport
Posted on by 320

Hello.

We are using CRM online version 9.1

Recently we have started getting this error when a new Invoice is created.

All javascript code used to work fine before this.

erro1.JPG

TypeError: Cannot read property 'substring' of undefined
    at populateInvoicingDetails (https://.crm6.dynamics.com/%7B636992478630006820%7D/WebResources/new_PopulateInvoicingDetails?ver=-403942360:10:33)
    at eval (eval at RunHandlerInternal (https://.crm6.dynamics.com/form/ClientApiWrapper.aspx?ver=-403942360:154:1), <anonymous>:1:1)
    at RunHandlerInternal (https://.crm6.dynamics.com/form/ClientApiWrapper.aspx?ver=-403942360:160:1)
    at RunHandlers (https://.crm6.dynamics.com/form/ClientApiWrapper.aspx?ver=-403942360:118:1)
    at OnScriptTagLoaded (https://.crm6.dynamics.com/form/ClientApiWrapper.aspx?ver=-403942360:275:1)
    at https://.crm6.dynamics.com/form/ClientApiWrapper.aspx?ver=-403942360:244:1

Any help would be appreciated. Thanx.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rajesh Chungath Profile Picture
    467 on at

    Hi Huzefa Bootwala,

    Please validate the java-scripts on save events. If you are doing any string operations if the filed value is empty system trigger error. Please share the code lines so we can suggest a solution.  

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Can you please share JS function written in the web resource  -"new_PopulateInvoicingDetails" which is calling in on-save / on -load event.

    Error says that you are doing subsisting on some attributes which does not have subsisting properties .  I am suspecting that you need to do null check before doing substring like below  -

    var str = "Hello world!";

    if(str != null )

    {

    var res = str.substring(1, 4);

    }

  • Verified answer
    Florian Popescu Moscu Profile Picture
    160 on at

    There's a web resource mentioned in the error message: "new_PopulateInvoicingDetails". I assume this is a javascript library.

    Anyway, to see if the issue is caused by custom code, disable the onsave event on the invoice form and see if the error still appears.

  • Huzefa Bootwala Profile Picture
    320 on at

    Hi,

    Found the reason. Original code was added on change of a filed and also onLoad.

    Thats the reason it was showing null error as it could not find the value for onChange.

    Thanx everyone for the help.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans