VicDid VicDid - 1 year ago 170
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download