Skip to main content

Notifications

Announcements

No record found.

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

  • Huzefa Bootwala Profile Picture
    320 on at
    RE: Error when creating a new record for javascript code

    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.

  • Verified answer
    Florian Popescu Moscu Profile Picture
    160 on at
    RE: Error when creating a new record for javascript code

    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.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Error when creating a new record for javascript code

    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
    Rajesh Chungath Profile Picture
    467 on at
    RE: Error when creating a new record for javascript code

    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.  

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
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans