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-08-2023 04:58 AM
Hi Brad,
Appreciate your reply.
I have managed to make some progress. Figure out how to create Catalog Item not via App Studio. Also learnt how to add Catalog Client Script to a value. Did that. Now the selection list seems to be eager to be populated, but not yet. Please, see screenshots attached. I feel i am getting closer.... with your help : )

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2023 06:32 AM
It looks like maybe you need to inspect what the JSON response actually looks like. Is it an array of strings or array of objects? I think the addOption method is expecting two strings for the label and value. You might do some logging within the for loop to check that out.