14-Day Automatic Closure of case record with automatic email is triggered to the "requester"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 06:49 AM
we have record producer "Platform Access Request" and respective flow for the case record life cycle.
based on the Request Type choices below
flow will triggers approvals in only 2 choices( first and 4) selection for the record producer.
Now we need to implement
GIVEN the "Platform access request" case remains unapproved or unrejected by the 14th day
WHEN no action has been taken
AND the case is not assigned to any user
THEN the case is marked as "Closed Incomplete"
AND the case state is updated to "Closed Incomplete" with the "Close code" as "Closed: Not approved"
AND the "Close notes" are updated to: "The case has been closed because it was not approved in the defined time. If you still require the requested action, please submit a new case."
AND an automatic email is triggered to the "requester" and "requested for"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 06:57 AM
you can use flow for this with wait for condition and after 14 days close it and send email
what did you start with and where are you stuck?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 11:24 PM
yesterday
for above flow 1 Screenshot If approved(approved) and 2 Screenshot else if if not approved with 4 of other approval states(rejected, skipped,cancelled and no longer required) on top of we need to close the case on 14 day of case opened, when case state is awaiting approval with approval requested, as per our present flow cases are staying still with awaiting approval we need ensure that 14 days are time out case to get closed with automatic email notification.
I have tried else if (requested) with timer and wait for condition's nothing works out it.
below is the ask for approval condition's
Please suggest how we can achieve my requirement. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2025 11:30 PM
// Auto-close Financial Cases in 'Awaiting Approval' for 14+ days
var caseGR = new GlideRecord('x_jj_dfit_case');
caseGR.addQuery('state', '5'); // Confirmed: '5' = Awaiting Approval
caseGR.addQuery('record_producer', '58d2d15adbc4341056b9475f29961970');
caseGR.addQuery('opened_at', '<=', gs.daysAgoStart(14));
gs.info('[Auto-Close] Starting query...');
caseGR.query();
var count = 0;
while (caseGR.next()) {
gs.info('[Auto-Close] Found case: ' + caseGR.number + ' | Opened at: ' + caseGR.opened_at);
// Final sanity check inside loop
if (caseGR.state == '5') {
caseGR.state = '4'; // Closed
caseGR.resolution_type = 'Closed: Not approved';
caseGR.close_notes = 'The case has been closed because it was not approved in the defined time. If you still require the requested action, please submit a new case.';
caseGR.closed_at = new GlideDateTime(); // Optional
caseGR.update();
gs.info('[Auto-Close] Case closed: ' + caseGR.number);
count++;
} else {
gs.info('[Auto-Close] Skipped case ' + caseGR.number + ' due to unexpected state: ' + caseGR.state);
}
}
gs.info('[Auto-Close] Total cases closed: ' + count);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 01:00 AM