How to create database view on sys_history_line, sys_history_set and u_finance_request

Akshaykhare
Tera Contributor

I am creating database view on sys_history_line, sys_history_set and u_finance_request but somehow confused with the where clause as it is not working. Image attached for the reference.

The last where clause is history_id=freq_sys_id && history_table=freq.

Screenshot 2025-01-31 173335.png

1 ACCEPTED SOLUTION

@Akshaykhare 

sys_history_set table is in rotation policy so I doubt it will show data even after correctly configuring the database views.

why not use Audit table?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@Akshaykhare 

I won't recommend creating database view on system tables

those tables are huge so it will lead to performance issue

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@Akshaykhare 

something like this if you still require

AnkurBawiskar_0-1738326555504.png

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar : first two tables are getting joined but as soon as I added sys_history_line with the where clause, then it is not working.

@Akshaykhare 

in table sys_history_set the ID field is document ID

so it needs to be handled differently

Database view - How to correctly join a table using a document_id field 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader