VicDid VicDid - 1 month ago 37
Javascript Question

ReferenceError: nlapiLoadFile is not defined error In Netsuite

I am trying to run a simple script that loads a json file and gets the contents of the file. However, the first line of the script already sends an error saying that a function from the SuiteScript API is not defined.
'ReferenceError: nlapiLoadFile is not defined' is what I'm getting.

function pageInit(context) {

var File = nlapiLoadFile('/SuiteScripts/jsonfile.json');

I'm thinking there might be a problem with my account because I had a similar problem with SuiteScript 2.0 where the entire File module was missing in the API on my account. That is why I'm using 1.0 as shown above.


Since you're trying to call this in pageInit(), I'll assume that you're creating a client script. nlapiLoadFile() is not available in client scripts. According to the help file for that function: This API is supported in server-side scripts.