How to use joins in glide record?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 05:30 AM
Hi Team,
Can anyone help in combine two tables and query that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 05:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 06:50 AM
Hi,
you can use Database View
see following for details
Database Views - ServiceNow Wiki
http://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 07:30 AM
Hi Smitha,
Please find the example :
/ Look for Problem records
var gr = new GlideRecord('problem');
// That have associated Incident records
var grSQ = gr.addJoinQuery('incident');
// Where the Problem records are "active=false"
gr.addQuery('active', 'false');
// And the Incident records are "active=true"
grSQ.addCondition('active', 'true');
// Query
gr.query();
// Iterate and print results
while (gr.next()) {
gs.print(gr.getValue('number'));
}
Thanks
Prakash

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 07:34 AM
Hi Smitha,
One of my colleagues wrote a couple of blog posts to help out with understanding database views that are really helpful. You might check them out to get a little more info on how they work compared to a sql join.
ServiceNow Admin 101: Observations on Database Views, Part I - Cloud Sherpas
ServiceNow Admin 101: Observations on Database Views, Part II - Cloud Sherpas