
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2017 07:20 AM
I've written the below script which works fine. However, I need it to run on records that have not been updated for 48 hours OR MORE. I believe right now its only running on records that haven't been updated for 48 hours, and not records that was updated more then 48 hours ago. Could someone help me incorporate the OR More part into my script?
var gr= new GlideRecord("x_hemas_connectus2_x_hemas_connectus_connectus");
gr.addEncodedQuery('sys_updated_on<javascript:gs.daysAgoStart(2)');
gr.addQuery('audience','!=','Client');
gr.addQuery('audience','!=','Other');
gr.addQuery('current_status','!=','Complete');
gr.addQuery('current_status','!=','Requestor Canceled');
gr.addQuery('current_status','!=','Closed-CCCU Reported');
gr.addQuery('current_status','!=','Clarification Needed');
gr.addQuery('current_status','!=','Draft');
gr.addQuery('current_status','!=','Acknowledged');
gr.addQuery('current_status','!=','In Progress');
gr.addQuery('current_status','!=','Client Request Not Met');
gr.addQuery('current_status','!=','Rebuttal Submitted');
gr.addQuery('current_status','!=','Rebuttal Rejected');
gr.addQuery('current_status','!=','New');
gr.addQuery('current_status','!=','Complete - AutoClosed');
gr.query();
while(gr.next()){
gs.eventQueue('x_hemas_connectus2.closeinternal',gr, gr.current_person_assigned,gr.sys_created_by);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2017 07:47 AM
Hi Edwin, You have to use 'daysAgo(2)' instead of 'daysAgoStart(2)'.
Ex: Current Time - 2017-01-23 07:25:00
daysAgo(2) - will take 48 hours --> This will return '201-01-21 07:25:00'
daysAgoStart(2) - this will take start of 2 days ago --> This will return '201-01-21 00:00:00'
So by changing your query as below should work:
var gr= new GlideRecord("x_hemas_connectus2_x_hemas_connectus_connectus");
gr.addEncodedQuery('sys_updated_on<javascript:gs.daysAgo(2)');
Hope this helps.
With Regards,
Damodar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2017 07:29 AM
What I always find useful is getting all the records I want to change in a list and copying the query from that and putting it in an encoded query:
active=true^priority=1^assignment_group=8a4dde73c6112278017a6a4baf547aa7^sys_updated_on<=javascript:gs.dateGenerate('2016-11-15','11:40:45')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2017 07:47 AM
Hi Edwin, You have to use 'daysAgo(2)' instead of 'daysAgoStart(2)'.
Ex: Current Time - 2017-01-23 07:25:00
daysAgo(2) - will take 48 hours --> This will return '201-01-21 07:25:00'
daysAgoStart(2) - this will take start of 2 days ago --> This will return '201-01-21 00:00:00'
So by changing your query as below should work:
var gr= new GlideRecord("x_hemas_connectus2_x_hemas_connectus_connectus");
gr.addEncodedQuery('sys_updated_on<javascript:gs.daysAgo(2)');
Hope this helps.
With Regards,
Damodar