The CreatorCon Call for Content is officially open! Get started here.

Connect Script to UI component

NatG
Tera Contributor

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.

6 REPLIES 6

NatG
Tera Contributor

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 : )

Brad Tilton
ServiceNow Employee
ServiceNow Employee

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.