The CreatorCon Call for Content is officially open! Get started here.

Close cases without Updating Updated field and prevent notification being sent

MichaelZischeck
Kilo Sage

Hi

 

We have a weird issue, where hundres of cases are not being closed, as the auto close field is not set to true.

 

I'd like to close those case (which are on resolved), but I don't want to update the Updated field, neither I want to send notifications to users about cases months in the past.

 

Is this possible?

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hello @MichaelZischeck ,

 

To close those old cases without updating the 'Updated' field or sending notifications, you can:

1. Temporarily Disable Business Rules/Workflow/Flow/Notifications: Turn off any business rules, workflow, flow, or notifications that might trigger during the update.

2. Use a Background/Fix Script: Run a script to close the cases. Here's a simple example:

 

GlideRecord.setDisableUpdateAudit(true);  // Prevent updating the 'Updated' field

var caseGR = new GlideRecord('case_table');  // Replace with your table name
caseGR.addQuery('state', 'resolved');  // Find resolved cases
caseGR.addQuery('auto_close', false);  // Where auto_close is not true
caseGR.query();

while (caseGR.next()) {
    caseGR.setWorkflow(false);  // Disable workflows
    caseGR.auto_close = true;   // Mark as auto-closed
    caseGR.state = 'closed';    // Change the state to closed
    caseGR.update();            // Save the changes
}

GlideRecord.setDisableUpdateAudit(false);  // Re-enable auditing

 

3. Turn Everything Back On: After the script, re-enable business rules and notifications.

 

This will quietly close the cases without bothering anyone or messing up the 'Updated' field!

 

Please follow these best practices for your task:

1. Test First: Run the script in a test environment to ensure it works as expected.

2. Backup Data: Export the list of cases as a backup before making changes.

3. Use Key Commands: Apply `setWorkflow(false)` and `setDisableUpdateAudit(true)` to avoid triggering workflows and updating the `Updated` field.

4. Process in Batches: If there are many cases, update them in smaller batches to avoid performance issues.

5. Document Everything: Keep a note of the script used and cases affected for future reference.

This will help you complete the task smoothly and safely!

 

You can refer to this for more details:

1. Exploring Auditing

2. Exclusion list Auditing - How to activate/deactivate auditing for a specific table or field

View solution in original post

3 REPLIES 3

Community Alums
Not applicable

Hello @MichaelZischeck ,

 

To close those old cases without updating the 'Updated' field or sending notifications, you can:

1. Temporarily Disable Business Rules/Workflow/Flow/Notifications: Turn off any business rules, workflow, flow, or notifications that might trigger during the update.

2. Use a Background/Fix Script: Run a script to close the cases. Here's a simple example:

 

GlideRecord.setDisableUpdateAudit(true);  // Prevent updating the 'Updated' field

var caseGR = new GlideRecord('case_table');  // Replace with your table name
caseGR.addQuery('state', 'resolved');  // Find resolved cases
caseGR.addQuery('auto_close', false);  // Where auto_close is not true
caseGR.query();

while (caseGR.next()) {
    caseGR.setWorkflow(false);  // Disable workflows
    caseGR.auto_close = true;   // Mark as auto-closed
    caseGR.state = 'closed';    // Change the state to closed
    caseGR.update();            // Save the changes
}

GlideRecord.setDisableUpdateAudit(false);  // Re-enable auditing

 

3. Turn Everything Back On: After the script, re-enable business rules and notifications.

 

This will quietly close the cases without bothering anyone or messing up the 'Updated' field!

 

Please follow these best practices for your task:

1. Test First: Run the script in a test environment to ensure it works as expected.

2. Backup Data: Export the list of cases as a backup before making changes.

3. Use Key Commands: Apply `setWorkflow(false)` and `setDisableUpdateAudit(true)` to avoid triggering workflows and updating the `Updated` field.

4. Process in Batches: If there are many cases, update them in smaller batches to avoid performance issues.

5. Document Everything: Keep a note of the script used and cases affected for future reference.

This will help you complete the task smoothly and safely!

 

You can refer to this for more details:

1. Exploring Auditing

2. Exclusion list Auditing - How to activate/deactivate auditing for a specific table or field

MichaelZischeck
Kilo Sage

Hi 

Thanks.. I accept your answer as solution. However, the  "setDisableUpdateAudit" i could not find in API.

So I used:

gr.autoSysFields(false);
gr.setWorkflow(false);
gr.setUseEngines(false);
instead..
 
First tests seem promising. Thanks for pointing into the right direction.
 
Michael

Community Alums
Not applicable

Hi @MichaelZischeck ,

 

Glad to hear that the solution is working for you! Thank you for sharing your approach with gr.autoSysFields(false);, gr.setWorkflow(false);, and gr.setUseEngines(false);. These are excellent alternatives to achieve a similar outcome by controlling system fields, workflows, and engines.

 

I'm happy to have pointed you in the right direction. If you encounter any further challenges or need additional assistance, feel free to reach out.