I want to display two table data in one list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 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
3 hours ago
what's your actual business requirement here?
if something is common between those 2 tables then you can join using database view
Then you can make your reference variable/field point to this database view
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
