Calling Server Side Script includes from UIB Client Scripts
Jace's Blog
·
May 11, 2025
·
article
This could be improved a lot.
Let’s first talk about how this is working for me.
Everything I read to do this either says make a rest call or use the “new transform data resource”. When trying the data resource it never seemed to run the script include. So I went with rest. I’m sure I missed something I’ll be asking Tomas about this.
My working steps.
1. Find or Create a Script Include
2. Create a REST Endpoint that calls your Script Include
3. Create a Client script using the helpers and snHttp method to call said REST endpoint
4. Profit
helper has a method called snHttp, which by default batches your request up (you can set an option of batch to false to stop that.
To take advantage of a rest call to call a server side script include, you’ll need to make a rest api … really?
yep. one thing to note is you can use the async/await in the uib client scripts so that’s nice.
[ServiceNow Docs on Helper](https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/app-store/dev%5Fportal/API%5Freference/helpers/concept/helpersAPI.html?utm%5Fsource=jace.pro&utm%5Fmedium=newsletter&utm%5Fcampaign=calling-server-side-script-includes-from-uib-client-scripts)
[Community post on Client Side Script Includes](https://www.servicenow.com/community/developer-forum/how-to-use-script-includes-in-ui-builder/m-p/2510525?utm%5Fsource=jace.pro&utm%5Fmedium=newsletter&utm%5Fcampaign=calling-server-side-script-includes-from-uib-client-scripts) (says to do this you need to make a rest call)
[Useful examples of snHttp](https://www.servicenow.com/community/developer-forum/call-script-include-from-ui-builder/m-p/2102347?utm%5Fsource=jace.pro&utm%5Fmedium=newsletter&utm%5Fcampaign=calling-server-side-script-includes-from-uib-client-scripts)
---
[Powered by beehiiv](https://www.beehiiv.com/?utm%5Fcampaign=46aea1d0-5ac8-4c6a-9b19-2184f782df96&utm%5Fmedium=post%5Frss&utm%5Fsource=jace%5Fs%5Fblog)
https://jace.pro/p/calling-server-side-script-includes-from-uib-client-scripts