How do I call a js library from a UI script and where do I store that library?

Blair5
Tera Guru

We are implemented an internal analytics tool into our instance. I have the script tags within a global UI script and there is its own JS library. I created the library as a UI script as well since I saw jquery.min is stored there. Is that the right approach? If so, how do I call it in the scirpt tag? I tried calling it by sys_ui_script/<NAMEOFSCRIPTINCLUDE> but got a ton of errors in the console.

8 REPLIES 8

I get this error in the console: Cannot read property 'appendChild' of null


Blair,



I would change the src to be src="file.min.jsdbx"


Chris,



Now I get this error: Uncaught SyntaxError: Unexpected token <


From here I would have to ask where are you trying to execute the script?


It appears that since this is marked as a global UI script it is going to be running, well globally meaning that you don't have to necessarily use this in a UI type page (UI, CMS, etc. ).


Anyway basically the error means that there is an extra "<" somewhere in your code or where ever you may be trying to use it.



Attached is a screenshot showing a simple example of this working as it is.



globally_available_script.png