Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Create DB view using reference from User table

Rush B
Tera Contributor

I need to create Database view for 2 tables, their is no common SYSID among the 2 tables. Both tables have a field storing reference to User table I need to join the tables using user table please help with providing the where clause I should use. 

3 REPLIES 3

Chaitanya ILCR
Mega Patron

Hi @Rush B ,

since you didn't mention table names
I have setup DBV on incident and problem table using assigned to field

ChaitanyaILCR_0-1736957926765.png

 

you can adjust it as per your tables

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Hi @Chaitanya ILCR ,

Example have a DBV with 2 tables 

Where clause is:-  t1_f1 = t2_f2   (f1 and f2 both stores same value thats a  reference to user table) running the DBV gives error saying Where clause in view "my_view_name" has an invalid field or a field that is not visible (t1_f1)

Hi @Rush B ,
Can you share the screenshot?

ChaitanyaILCR_1-1736962454627.png

try adding the field in the view fields as stated other posts
https://www.servicenow.com/community/developer-forum/database-view-quot-invalid-field-quot-error-wit...

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya