- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
Below are the requirements.
Are there any out-of-the-box features that meet these requirements?
I thought I could use a database view,
but is there a limit to the amount of information that can be displayed?
- There are two custom tables.
- The two tables each have a different form layout.
- The user has requester privileges.
- Records are added to the two custom tables daily.
- Records from both tables are displayed in a single list.
- Users operate through the portal screen.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
I ran your requirement for displaying two table data in one list through snowcoder ai. This is a common need in ServiceNow, and there are a few solid approaches depending on your exact use case.
## Option 1: Database View (Recommended for Read-Only Lists)
This is the most common and cleanest approach. A **Database View** lets you join or union two tables and display them as a single list.
1. Navigate to **System Definition > Database Views**
2. Click **New**
3. Give it a name (e.g., `combined_data`)
4. In the **Tables** related list, add both tables
5. Map the columns you want to display from each table
Once created, you can create a list view on the Database View just like any other table. This works great for reporting and read-only display.
**Key consideration:** Database Views are read-only. You cannot update records directly from the view.
## Option 2: Union of Two GlideRecord Queries (Service Portal / Widget)
If you're working in **Service Portal**, you can build a custom widget that queries both tables and merges the results into a single array:
```javascript
// Server Script in a Service Portal Widget
(function() {
var combined = [];
var gr1 = new GlideRecord('incident');
gr1.addActiveQuery();
gr1.setLimit(50);
gr1.query();
while (gr1.next()) {
combined.push({
number: gr1.getValue('number'),
short_description: gr1.getValue('short_description'),
source_table: 'Incident'
});
}
var gr2 = new GlideRecord('change_request');
gr2.addActiveQuery();
gr2.setLimit(50);
gr2.query();
while (gr2.next()) {
combined.push({
number: gr2.getValue('number'),
short_description: gr2.getValue('short_description'),
source_table: 'Change Request'
});
}
data.items = combined;
})();
```
Then render `data.items` in your HTML template as a single list.
## Option 3: Parent Table / Table Inheritance
If both tables extend a common parent table (e.g., both extend `task`), you can simply create a list on the **parent table** and it will naturally show records from both child tables. For example, listing from the `task` table will show incidents, changes, problems, etc. all in one list.
Navigate to `task.do` or `task_list.do` and filter as needed.
## Option 4: Report with Multiple Data Sources
You can also create a **Report** using a Database View or a parent table to visualize combined data in list format.
## Quick Recommendation
| Approach | Best For |
|---|---|
| Database View | Read-only lists in Core UI, reporting |
| Widget with dual GlideRecord | Service Portal, custom UI needs |
| Parent table query | Tables that share a common parent (like task) |
**Common pitfall:** If the two tables have very different schemas, mapping columns in a Database View can get tricky. Stick to shared or similar fields for the best results.
If you're dealing with a more complex scenario - like needing to combine tables with no common parent and still have inline editing - that's where things get more involved and a custom UI Page or widget becomes the way to go.
Hope this helps! Let us know which approach fits your scenario best.
_______________________________________
I used snowcoder ai to generate this. If you need to tweak the requirements, you can run it through their Yeti AI for free.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
Hi @bonsai
You can create a database view, but it does not provide a form interface. A database view can be used for reporting purposes, not for form views.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
Would it be possible to meet the requirements by creating a parent table for the two custom tables and providing two custom tables that extend the parent table?
Since the records of the two tables are stored in the parent table,
I believe they can be displayed in a single list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12 hours ago
Hi @bonsai
yes but that will be customisation and by BR /scripts you can do
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
13 hours ago
Yes, this can be done. But again depends on what you want to achieve, just show as list or provide any actions from the list as well.
