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.

Database view

Nandhinisri
Tera Contributor

Hi

 

I want to create a database view for incident and related changes. How can I achieve that?

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Nandhinisri 

Do you mean the change in the related list?
What exactly is your use case? Because this can also be achieved without using a database view, like this...

 

DrAtulGLNG_1-1759844990115.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@Nandhinisri 

incident already has fields to store related CHG

What's your actual business requirement to create database view?

AnkurBawiskar_0-1759845185005.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

Bhuvan
Giga Patron

@Nandhinisri 

 

If you are looking for incidents and related changes using incident table field 'caused_by' relation, configure database view using below. If your requirement is different, alter the where clause accordingly

 

Change table, prefix chg with order of 100

Incident table, prefix inc with order of 200 and Where clause is inc_caused_by=chg_sys_id

 

Below is a sample database view for reference

 

Bhuvan_0-1759845133985.png

 

Please note if your requirement is to only show incident and change relation in a dashboard or report, you do not need to create database view as this would make sense only if you are combining multiple tables in a view that is not available out of box.

 

If this helped to answer your query, please mark it helpful & accept the solution. 

 

Thanks,

Bhuvan