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 where clause to have created in this month condition

Naveen87
Tera Guru

 

Hello Developers,

 

I'm creating a Database view, Incident table is parent here. I'm successful fetching the data however its bit slow.

So I want to add another where clause to check incident created in this Month.

I used the query but it's not supported in Database view & got the below error.

Can anyone please suggest how to add created in this month query here?

Naveen87_1-1731322493812.pngNaveen87_2-1731322502774.png

 

 

Naveen87_0-1731322473836.png

 

1 ACCEPTED SOLUTION

Hi @Dr Atul G- LNG ,

 

This worked for me

'inc.sys_created_on>= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)&&inc.contact_type!='Event''

 

Got reference from here

https://www.servicenow.com/community/developer-forum/database-view-date-parameter/m-p/1417336

View solution in original post

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Naveen87 

 

2nd part can be done in reporting only. Use DB view in report and get the data from report.

*************************************************************************************************************
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]

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

Hi @Dr Atul G- LNG ,

 

This worked for me

'inc.sys_created_on>= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)&&inc.contact_type!='Event''

 

Got reference from here

https://www.servicenow.com/community/developer-forum/database-view-date-parameter/m-p/1417336

Good to know mate.

You can also accept my answer, as I redirected to the right way.

*************************************************************************************************************
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]

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