Referencing a .js file, why are those functions not recognised?

From the help file (https://help.hcltechsw.com/domino_volt/1.0.1/ref_jsapi_running_external_js_files.html), it seemed to imply that I can load a custom js file as long as all the function inside is on the format of : app.getSharedData().functionName = function(parameter) .

So to test this, I move a couple of function from the application on start section to a js file. I made sure that none of the function is listener and only use either app object or whatever object passed via parameter. After uploading said js file and testing a button that called a function within that js file, but Volt gave me a prompt error saying that function is not found.

Is there anything else I need to do after uploading the js file ? Do I need to reference them in the button ? That help topic said that any function within the uploaded js file is automatically loaded.

Tinus Riyanto - Prisma Global Solusi

Write it as a callback function in the argument of app.getSharedData().loadScript().
Or.
I think it's either that or write it as a callback function with a require() argument.

You can read about it here.

https://hclpnpsupport.hcltech.com/community?id=community_question&sys_id=5dcacab81ba89858c1f9759d1e4bcbe3

But the JS file does not exist on internet so I can't exactly reference it by URL. I have uploaded the JS file into the Volt apps. What URL do I use to reference it ?

My bad, I make some typos on the declaration code. No wonder it said function could not be found.

Well, at least I prove that attached JS is loaded automatically as stated in the help file. No need to do require or other trick.

Yes, I did. You're right, I could have done it without using require().

I used the attached js file, but I was able to do it in the following way.

Using the app.getFileBaseURL() function, you can get the relative path of the folder containing the attached js file.

var url = app.getFileBaseURL() + <Attached js file name>;
Eg...
var url = app.getFileBaseURL() + "test.js";

https://help.hcl-software.com/domino_volt/1.0.1/ref_jsapi_user_interface_objects.html