Automatic Closure of case record with an automatic email is triggered to the "requester"

vinnus
Tera Contributor

Case state= awaiting approval

Assigned to = empty 

we need close the case on the 14 day, case remains unapproved or unrejected by the 14th day

an automatic email is triggered to the "requester" and "requested for" with the following content.

the case is marked as "Closed Incomplete"

"Close code= "test"  updated

"Close note=test"    updated

 

How can we achieve the above requirement 

3 REPLIES 3

BrianProvencher
Giga Guru

You can accomplish the closure of the case via a business rule or a flow.

You can accomplish the email using a notification.

 

vinnus_0-1746253373102.png

 

 

vinnus_1-1746253373099.png

 

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

vinnus_2-1746253373105.png

 

 

 Please suggest how we can achieve my requirement. Thanks

Scheduled Jobs > Scheduled Script Executions: i tried below Scheduled Job not working out can please guide
 
 
javascriptCopyEdit(function executeRule(current, gsr) {
    var caseGR = new GlideRecord('x_jj_dfit_case');
    caseGR.addQuery('state', 'awaiting_approval');
    caseGR.addQuery('sys_updated_on', '<=', gs.daysAgoStart(14));
    caseGR.addQuery('producer', '!=', '');
    caseGR.addQuery('item.name', 'Service Management Platform Access Request');
    caseGR.query();

    var casesProcessed = 0;

    while (caseGR.next()) {
        caseGR.state = '5';
        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.auto_closed = true;
        caseGR.update();
       // gs.eventQueue('fsm.case.auto.closed', caseGR, caseGR.requested_for.email, '');
        casesProcessed++;
    }

    gs.info('Auto-closure job processed ' + casesProcessed + ' FSM cases.');
})();