Date filter using script include

anil53
Kilo Contributor

Hi All,

To fetch incident records using schedule job, I have to apply date filter in script include.

i have query regarding this filter.

1. As snow db store data in GMT format , so in which format date field value should be applied as filter?

I think whenever we use INCIDENT UI Form to filter records based on creation date, we apply filter based on user's time zone which use to internally converted to GMT format.

So when we use script include, so should we write code to directly apply filter as per user's time zone or should we apply filter in GMT time zone on incident table ?

 

For Example :--

If i have to filter incident records from 7 july 2018 to 10 july 2019, what should we the correct syntax.

 

 

Please support.

 

 

6 REPLIES 6

anil53
Kilo Contributor

Hi ,
This query will work only for fixed date/time. what would be the query for dynamic date/time? For example :- alert creation date etc.


grInc.addEncodedQuery("sys_created_onBETWEENjavascript:gs.dateGenerate('2018-07-10','10:00:00')@javascript:gs.dateGenerate('2018-07-10','17:00:00')");

How can we utilize this dynamic creation date (ex alert creation date) in place of ('2018-07-10','10:00:00').

Hello Anil,

 

I am trying to do the same with dynamic date/time. I am stuck with the same problem. Could you please let me know what have you done to solve this issue

Thank you very much

Harish Gubba