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

Show result from API Request as list items (UI Builder)

mmorski
Tera Contributor

Hi,
In servicenow I would like to build my own "Experience" in UI Builder and my goal is to use Data Resource which executes REST request and returns Json with array of objects. Now I want to present those objects in some list view (like in "Related List" component) because I want to have functionality like search over this list, filter this list and by clicking element at the list I want to open new tab in browser with link which is one of the fields in Json. This functionality is present at the Record editing level. For example we have "Incident" and when we go to details about Incident we can see another component with this list. So for every Incident we have different values and we don't store them in the tables but it's always returned JSON from API.
Which UI component should I use? Can I use "List Related" but instead of using "table" as a Input I will use my Json with correct format? Or maybe "Search Result" will fit? 
Can I use "Contact Card" for this and organize them in list? "Related content" is also promising to achieve this. I was tried also with "Rich text" and to produce whole HTML page by script which delivers data, but this solution is "ugly".
One last idea is to build own list with own rows (every row will have: icon, title, subtitle, author, document type), but for that I need some documentation how can I build it.

3 REPLIES 3

Kevin83
ServiceNow Employee
ServiceNow Employee

mmorski
Tera Contributor

Hi @Kevin83  Presentational List Component is a little bit complicated to what I need for now. I just used "Related Content" component and "Input" field. The whole solution is designed like this: In Rest Messages I have Rest Message which sends parametrazed request and returns Json. In "Data Broker Server Scripts" I have defined Transformation which uses text value from "Input" field, executes REST request and converts returned value to Json which fits to "Related Content" component. Later in the UI Builder I bind this transfromation to "Related Content" element and "Input" field has defined event when user press "Enter" the "Client State Parameter" will be updated.

mmorski
Tera Contributor

Hi @Kevin83  Presentational List Component is a little bit complicated to what I need for now. I just used "Related Content" component and "Input" field. The whole solution is designed like this: In Rest Messages I have Rest Message which sends parameterized request and returns Json. In "Data Broker Server Scripts" I have defined Transformation which uses text value from "Input" field, executes REST request and converts returned value to json which fits to "Related Content" component. Later in the UI Builder I bind this transformation to "Related Content" element and "Input" field has defined event when user press "Enter" the "Client State Parameter" will be updated.