- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 03:25 AM
Hi,
I was wondering if there's any module or platform functionality that resembles Script Includes, but runs the code on the client-side?
In my use case, I need to reuse the same verification of inputs and then make a GlideAjax call on two Catalog Client Scripts running on two separate fields.
The fields are:
- VAT - read-write
- Netto - read-write
- Brutto - read-only, to be written to by g_form.setValue
On changes of either VAT or Netto, I'd like to trigger the same calculation and write the received value to Brutto, or handle any errors/incorrect returns within the shared function. It doesn't need to happen on the server-side in this instance, but let's say I may need to use the same way of thinking in the future where this is necessary.
I'm asking about this because I've started to look for more ways to simplify maintenance. If there's more than one place with the same code snippet, perhaps it could be placed in a shared library, just like Script Includes?
The code also needs to execute on both backend and front-end (SP/EC), so if it's not accessible from either platform, it's a no go.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 04:31 AM
@JeremiP Client side equivalent of Script Include is UI Script. UI scripts provide a way to package client-side JavaScript into a reusable form, similar to how script includes store server-side JavaScript. Administrators can create UI scripts and run them from client scripts and other client-side script objects and from HTML code.
For more information please refer to https://docs.servicenow.com/bundle/utah-application-development/page/script/client-scripts/concept/c...
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2024 04:31 AM
@JeremiP Client side equivalent of Script Include is UI Script. UI scripts provide a way to package client-side JavaScript into a reusable form, similar to how script includes store server-side JavaScript. Administrators can create UI scripts and run them from client scripts and other client-side script objects and from HTML code.
For more information please refer to https://docs.servicenow.com/bundle/utah-application-development/page/script/client-scripts/concept/c...
Hope this helps.