Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Receiving Error: "Unable to get property 'substr' of undefined or null reference"

(0) ShareShare
ReportReport
Posted on by

Good afternoon -

I am receiving an error "Unable to get property 'substr' of undefined or null reference" from one of my JavaScript functions built into the Opportunities entity in my DEV environment.  The function is set up to run OnSave.  

There have been no added fields to the form that I can chalk up to causing this issue.  The same exact script is currently active in my PROD environment with no issues.  

I am very familiar with the setup and underlyings of the system, but have zero experience with JavaScript.  The piece was written by a third party during roll out of the system.  Would anyone be able to explain in simplistic terms what is causing this error?  Below is the exact script that is causing the issue.

Thanks!

function SalesStageCodingUpdate()
{ 
var step = Xrm.Page.getAttribute("stepname").getValue();
var Currentvalue = step.substr(3);
Xrm.Page.getAttribute("si_newstepname").setValue(Currentvalue);
}


*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Receiving Error: "Unable to get property 'substr' of undefined or null reference"

    Works perfectly!  Thank you so much 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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May 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 > 🔒一 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 54

#3
dkrishna Profile Picture

dkrishna 6

Featured topics

Product updates

Dynamics 365 release plans