Tuesday 7 January 2014

Unable to get property get_current of undefined or null reference

Error Message:

Unable to get property 'get_current' of undefined or null reference.

Problem Description:

I wrote JavaScript function in my core .js file and calling from SharePoint list form.


SharePoint Form

Core .js file



In that function i.e."TravelRequestAdminDocumentReceived()" I am trying to get some information about the current context through the SharePoint JavaScript object model and am getting below error.




Solution:

This error is occurred because SP.js file not get loaded. To load SP.js file before our function we need to use following function

ExecuteOrDelayUntilScriptLoaded(TravelRequestAdminDocumentReceived, "sp.js"); 




Remark : After your custom function in ExecuteOrDelayUntilScriptLoaded don’t use brackets “()”.

No comments:

Post a Comment