RE: UNEXPECTED_ERROR (TypeError: null is not a function, it is object. (NLRecordScripting.scriptInit$sys#495(eval)#1) )


I am creating the timesheet through the scripting but it is not created.

I am getting the UNEXPECTED_ERROR (TypeError: null is not a function, it is object. (NLRecordScripting.scriptInit$sys#495(eval)#1) ).

This is the script for creating the timesheet.

var recObj=nlapiCreateRecord(‘timesheet’,{recordmode:’dynamic’});
var date=nlapiStringToDate(’10/20/2019′);
var recId=nlapiSubmitRecord(recObj,true,true);
var recObj1=nlapiLoadRecord(‘timesheet’,recId);
var trandate= recObj1.getFieldValue(‘trandate’);


RE: UNEXPECTED_ERROR (TypeError: null is not a function, it is object. (NLRecordScripting.scriptInit$sys#495(eval)#1) )


Can you please help me anyone on this issue.

samallasravan564 Rookie Asked on October 28, 2019 in SuiteScript.

This error occurs when you read a property or call a method on a null object . That’s because the DOM API returns null for object references that are blank. An object is expected somewhere and wasn’t provided. So, you will get null is not an object error if the DOM elements have not been created before loading the script. In JavaScript , null is not an object; and won’t work. You must provide a proper object in the given situation.

We can resolve this type of issues by adding an event listener that will notify us when the page is ready. Once the addEventListener is fired, the init() method can make use of the DOM elements.

document.addEventListener('readystatechange', function() {

if (document.readyState === "complete") {




on April 16, 2020.
Add Comment
2 Answers

For one, it looks like you’re making your timesheet record in dynamic mode. If you’re going to do dynamic, you’ll need to select the line, set the values, and commit the line.

Beginner Answered on October 29, 2019.

Thank you for your response.

on October 30, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.