Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to build a tree view in ServiceNow

MMKK
Tera Expert

Hi All,

I am new to ServiceNow. How to build a tree view widget in ServiceNow from scratch?

2 REPLIES 2

Jaspal Singh
Mega Patron
Mega Patron

Did you check link? This has an update set as well that can be downloaded & altered as per need.

Rishabh Jha
Mega Guru

Hi @MMKK , 

You can also use an external js library to build a tree-view. This one is simple and easy to implement https://github.com/jonmiles/bootstrap-treeview.

All you'd have to do is to add the library's js code to a js include, and then add it to your widget as widget dependency. (Refer this for adding widget dependency: https://community.servicenow.com/community?id=community_article&sys_id=78cb624fdb5edbc0fc5b7a9e0f961...).

This library works really well, and all you'd have to do is to pass the data attribute of the tree-view, using either a static json, or GlideRecord query, using a recursive function.

I've used it in one of my projects, and it works really well, and gives you functionalities like search, highlighting the search results, setting the node & expand collapse icons etc. as well.

Thanks & Regards,

Rishabh Jha