- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2014 11:59 PM
Hi experts,
I wanted to create a 3-tier tree view for knowledge base documents or policies in ServiceNow ESS. For example, 1st tier will be country, 2nd tier will be department and 3rd tier will show sub-department with breakdown of documents related to that sub-documents.
Is this possible or has anyone has any ideas how to do it? Thank you for your time/
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2014 01:18 PM
Hi Alex,
There are a number of options and approaches for this depending on your requirements:
1. Reuse the GwtTree2 that ServiceNow uses elsewhere in the system: Cool UI Page
2. Create your own entirely server side in Jelly (will have performance problems on large trees or deep nesting)
3. Create your own using some client side script or framework you import in (jsTree or angular.js for instance)
I have done #2 and #3 in the past, never tried #1 because I can't control if ServiceNow drops GwtTree in favor of something else. I can control scripts that I import. Use ServiceNow's tree picker as an example or the UI Page in the link above. ServiceNow loads the first level of the tree and then loads subsequent levels only one node at a time as you expand the nodes. This is best for performance on larger trees.
The HTML for these trees can be done either with a <table> or <ul><li> format. So really, you are just running an initial GlideRecord to get the first tier. Then each time a '+' is clicked, if the node hasn't been loaded, run a GlideRecord query to get all records with the parent you just clicked.
I hope that helps. Let me know if you need more information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2018 09:24 AM
Hi Travis,
can you please write, how can I access the processor used in GwtTree2 example in Cool UI Page?
For example they used:
var tableNode = new TableTreeNode(rootNode, "", "Tables");
tableNode.processor = "FunctionTreeData";
rootNode.appendChild(tableNode);
I need a custom Tree, but:
- I could not find "FunctionTreeData" in my Instance
- I do not know how can I access the code and change it
- I do not know how can I write a Processor for Ajax call in this example.
Can you please help.
If you do not know, is it possible to share a code to generate a tree in UI page?
Many Thanks
Ali