UI Builder - List Components Tips and Tricks
ServiceNow Developer Blog
·
Apr 28, 2021
·
article
<
- The List - Simple is more of a barebones version of the list component that is basically just showing a list of data that you can click into without filters, pagination, etc. I think this type of component is more suited to a portal where someone is consuming information and may just need to click into a list item for more details.

List Filtering
The filter in the list components works as you would expect from any filter in ServiceNow. You click Edit filter in the list component properties and get a modal with a filter against whatever table you’ve configured in the table property on the component.
The issue that I’ve run into is: what if you want something more dynamic like Active is true AND Parent is equal to a page parameter or client state parameter? The first time I saw this, I expected it to work like flow designer where I could use some data pills inside the filter. It’s still possible to make it dynamic, but instead, you need to provide that component’s filter property with an encoded query. You can do that either by binding a client state parameter or something else representing an encoded query to the filter property, or by using a script in the filter property to produce an encoded query. In the video below, I’ll show the second approach.
The script we used in this video was:
function evaluateProperty({api}) {
return 'active=true^category=' + api.state.category;
}
List Refreshing
The other thing that I’ve run into is refreshing a list component programmatically instead of having to click the refresh button on the list component itself. The main use case I’ve seen for this is when you’ve created a record that goes in this list somewhere else on the page and you want to automatically refresh the list so it shows up. Basically, what you need to do is bind a client state parameter to the refresh property on the list component, and then set that parameter from a client script.
I’ll show that method in the video below:
The important line of code from this video is: api.setState('listRefreshed', {timestamp: Date.now()})
More Resources
Make sure to check out the previous posts in this UI Builder series, and stay tuned for more posts.
- Introduction to the New Now Experience UI Builder
- UI Builder - About Pages: Templates, Parameters, and Variants
- UI Builder - Data Resources
- UI Builder - EVAM Data Resources
- UI Builder - Client state parameters, Client Scripts, and Events
- UI Builder - Modals
- UI Builder - Resources
- UI Builder - Building from App Engine Studio
- UI Builder - Adding a Custom Component with Events
- UI Builder - Themes
- UI Builder - Client Scripts
Have a UI Builder topic you’d like me to hit in a future post? Let me know on Twitter, LinkedIn, or sndevs.com slack (@btilton).
]]>
https://developer.servicenow.com/blog.do?p=/post/quebec-ui-builder-lists/