Database View

Sandeep Thomas
Tera Contributor

Can we create database views without reference fields? or is it mandatory to have reference fields available to join tables, kindly assist, Thanks!

1 ACCEPTED SOLUTION

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Sandeep Thomas ,

In ServiceNow, creating database views without reference fields is indeed possible. While reference fields are commonly used for establishing relationships between tables, they are not mandatory for creating database views. 

 

Database views in ServiceNow allow you to create custom queries that can join multiple tables, apply filters, and define the data structure without necessarily relying on reference fields. Views can be based on any existing table(s) and can include fields from those tables.

 

Here's a general example of how you can create a view without using reference fields:

 

1. **Navigate to Database Views:**

   - In ServiceNow, go to `System Definition` > `Database Views`.

 

2. **Create a New Database View:**

   - Create a new view and define the tables you want to include in the view.

 

3. **Define View Fields and Join Conditions:**

   - Specify the fields you want in the view from the selected tables.

   - Define join conditions based on the appropriate fields in the tables, even if they are not reference fields.

 

For example, you can create a view that joins the Incident and Task tables based on the `number` field (which is not a reference field) to display incidents and their associated tasks.

 

While reference fields are useful for establishing relationships and simplifying data retrieval, they are not the only way to create views or join tables in ServiceNow. You can use any fields suitable for establishing relationships within the tables you want to include in your view.

 

Thanks,

Danish

 

View solution in original post

3 REPLIES 3

Peter Bodelier
Giga Sage

Hi @Sandeep Thomas,

 

I've never tried it, but in theory you could use any field in the Where clause.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Sandeep Thomas ,

In ServiceNow, creating database views without reference fields is indeed possible. While reference fields are commonly used for establishing relationships between tables, they are not mandatory for creating database views. 

 

Database views in ServiceNow allow you to create custom queries that can join multiple tables, apply filters, and define the data structure without necessarily relying on reference fields. Views can be based on any existing table(s) and can include fields from those tables.

 

Here's a general example of how you can create a view without using reference fields:

 

1. **Navigate to Database Views:**

   - In ServiceNow, go to `System Definition` > `Database Views`.

 

2. **Create a New Database View:**

   - Create a new view and define the tables you want to include in the view.

 

3. **Define View Fields and Join Conditions:**

   - Specify the fields you want in the view from the selected tables.

   - Define join conditions based on the appropriate fields in the tables, even if they are not reference fields.

 

For example, you can create a view that joins the Incident and Task tables based on the `number` field (which is not a reference field) to display incidents and their associated tasks.

 

While reference fields are useful for establishing relationships and simplifying data retrieval, they are not the only way to create views or join tables in ServiceNow. You can use any fields suitable for establishing relationships within the tables you want to include in your view.

 

Thanks,

Danish

 

AndersBGS
Tera Patron
Tera Patron

Hi @Sandeep Thomas ,

 

It should be possible to utilize any column (field) in the join string. Please share some additional info if you need further assist.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/