Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2025 06:44 AM
Hi @lpruit2 ,
I tried below script in the flow but it is fetching all records and not just the records which are created 15 days ago.
// Create GlideDateTime objects for 15 and 22 days ago
var today = new GlideDateTime();
var fifteenDaysAgo = new GlideDateTime();
// Subtract 15 and 22 days from today
fifteenDaysAgo.addDays(-15); // 15 days ago
// Define the conditions for the lookup (RITM table)
var gr = new GlideRecord('sc_req_item'); // RITM table (Request Item)
gr.addEncodedQuery(
'stage=waiting_for_approval^stateIN-5,1^approvalNOT INapproved,rejected' +
'sys_created_on' + fifteenDaysAgo.getValue()
);
// Execute the lookup and check if there are any matching records
gr.query();