Javascript external file

I am using a JS external file (I added it to the project via Project > Add New Code File. If I look in the file system, appStudio put it in my ‘modules’ folder inside the project and added a .js extension. It is the last file listed in the Project Explorer.

The file have several functions. However, when I call one using the function name (eg. setUp() ), the debugger says there is an uncaught reference error (see pictures).

So I tried adding this to the Project Extra Headers property per an answer in the discussion board;

But I got the error shown in the third picture.


Cindyerror1 error2

Assuming it’s called apiCallCode, it looks like it isn’t included in your deploy.

It sounds like you’ve done the right thing. Can you zip your project and send it to me? We’ll have a look.

Thanks - here is the project (it won’t work for you as it requires a secure VPN into work) -


OK, got it. I will have a look.

Where is the setUP() function defined? It is not in apiCallCode.

No need to put apiCallCode.js in the header. AppStudio merges it into code.js at runtime, so there is one less file to load.

1 Like

I had an issue with external files not “integrating” into my project when I used the menu to add them. I now drop them onto the project explorer, and then move them up to the beginning of the project, before all forms. It seems to work.

1 Like

This is what comes from coding late at night - spelling of setUP! Let me play with it more and get back to you - thanks and sorry to bother.