System Export Definition: condition for records resolved exactly 3 days ago?

Marlyse
Tera Contributor

Hi

I need to create an Exportfile  that contains records that have been resolved exactly 3 days ago. I do it with the Export Definition. 
The export runs every day so i have to use a conditon relative from "today". In de predifined list i just have the option "today" "yesterday" "7 days ago".....but I need exctly 3 days ago. 
How to i have to set the condition? Or can the predifined list be enlarged with oder filters? 
Thx. 

1 ACCEPTED SOLUTION

Mark Manders
Mega Patron

If it really needs to be the 3 days ago, you can best use resolved after 4 days ago and before 2 days ago. That's about the only way to get that in place.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

View solution in original post

3 REPLIES 3

Mark Manders
Mega Patron

If it really needs to be the 3 days ago, you can best use resolved after 4 days ago and before 2 days ago. That's about the only way to get that in place.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Thx a lot for the quick answer. I works perfeclty finde. 

hi @Marlyse 

 

Condition Builder


Export Definition: In your export definition, go to the "Conditions" section.
Field: Select the field that represents the "Resolved" date/time in your table (e.g., "Resolved," "Closed," etc.).
Operator: Choose "on" or "between" depending on your preference.
"on" will be an exact match to 3 days ago.
"between" allows you to specify a start and end time for 3 days ago.
Value (or Start/End Values): This is where you'll use relative date functions:

For On

 

javascript: daysAgoStart(3)

 

For between

 

//Start// javascript: gs.daysagoStart(3)
//End// javascript: gs.daysagoEnd(3)

 

Explanation
* gs.daysAgoStart(3): This script calculates the start of the day exactly 3 days ago.
* gs.daysAgoEnd(3): This script calculates the end of the day exactly 3 days ago (11:59:59 PM).

 


Additional Considerations
* Time Zone: Be mindful of your instance's time zone settings as this will affect when "3 days ago" is calculated.
* Scheduled Job: Ensure that your export definition is set up as a scheduled job to run daily.
* Data Accuracy: Always double-check your exported data to ensure that the records are indeed from exactly 3 days ago, especially if your data spans multiple time zones.

 

If you like this solution. Please kindly mark this as your best answer and help to contribute more to this community

MackI | ServiceNow Developer | 2 *Mainline Certification | LinkedIn Top IT Operation Voice 2023 | Sydney,Australia