Connect Script to UI component
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 04:26 AM
Hi all.
Completely new to ServiceNow and Scripting.
The task is to get data from an external API and show the result. I found this example, but not sure how to attach that onChange script. I assume those 2 select fields has to be done in UI Builder. Managed somehow (not sure if correct or not) to set the Field select to display "common" and "official" values. Then stuck... : (
Please, help.
Thank you in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 05:59 AM
Could you take a step back and describe the problem you need to solve? This specific script looks like it would run in a catalog client script, which would not be compatible with UIB. We need to know things like:
- What kind of data are you trying to pull
- What triggers the integration to kick off? A save, page load, button, value changing?
- Can you do the integration piece with integrationhub?
- What do you need to do with the results?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 06:06 AM
Hi Brad.
Thank you for trying to help.
Stepping back: i need to show how to connect external data to ServiceNow via, let's say API.
Ideally it would be a catalog item question (example: which country are you from) and the values to that dropdown would be populated based on API response. In original post i have attached the screenshot of one of the samples posted in this forum few years back, but do not have enough knowledge to accomplish that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 01:39 PM
Ok. If it's a catalog use case then I would take UI Builder out of the equation here as it'll probably be surfaced through a Service Portal rather than a UIB experience. Generally you'd want to handle integrations through Integration Hub, but if it has to be client side you'll have to do it through a client script like the one you showed. Doing a client side integration use case like that is probably going to involve a good bit of scripting using the GlideForm API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2023 03:36 AM
Hi Brad.
Appreciate your reply. Tried few things and made some very modest progress... I have created Catalog Item with 2 select fields. Created Catalog Client Script (OnChange) as per screenshot attached in the first post and applied it to the "field' value. What i see now when testing is an attempt to pull the list, but it looks like this (see file attached). Any idea what can cause that? I feel i am getting closer to the solution, but not yet. Any advise, please.