How to upload a JS file in ServiceNow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2019 12:41 AM
Hi,
We have a UI page that creates the front-end for one of our applications. The javascript part (built using Angular 7) is currently stored in a UI script and is included in the UI page by using <script> tag. So far so good.
But now as the application grows with more features, the size of the JS file is also getting bigger. Now the UI script can't hold the complete contents of the JS file. We're stuck there. I can upload the JS file to an external CDN and just import in the UI page using the script tag in the same way, but we don't want to upload the file outside of ServiceNow.
My question is, is there a way to upload the JS file within ServiceNow, and then use that file as CDN in the UI page? I looked at the solution, i.e. to use "Upload file" option in ServiceNow given here at External JS Plugins - Size too big for UI Script but that doesn't work, because the upload file feature looks like it's to upload an XML file and import the contents to ServiceNow from the xml file.
Does anyone know how I can solve this? Thanks in advance for your response.
Regards,
Bala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2019 12:46 AM
HI,
Below links may help you
Please make this answer is correct if answer your question
Thanks
Chandu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2019 01:32 AM
Chandu,
Thanks for the response. These posts talk mainly about how to use external libraries from CDN as URL or as an UI Script in ServiceNow.
My question is basically, how to upload the same library in ServiceNow (instead of external CDN) and get the URL, so that I can use that in my UI page.
One of the example URLs given in one of those posts is "scripts/libs/selectize.min.js" which is an OOB js file. How can I upload my own js file to the scripts/libs folder and use it?
Regards,
Bala

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2019 01:46 AM
Hi ,
For this Query: How can I upload my own js file to the scripts/libs folder and use it?
you can refer this below link it will helps you
https://community.servicenow.com/community?id=community_blog&sys_id=0e6c2ea1dbd0dbc01dcaf3231f9619f2
Thanks
Sanjay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2019 01:56 AM
Sanjay,
This is how we currently use the javascript file, i.e. compile angular code into one big js file, copy that js to a UI script and include that UI script in the UI page using script tag.
The problem now is, the size of the js file is too big and it's not possible to store the contents of the js file in the UI script anymore. That's why I'm looking for a solution that would help me upload the file to ServiceNow, get an URL, and use that URL in the UI page to include the js.
Regards,
Bala