- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 12:16 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 01:50 AM - edited 08-20-2024 01:57 AM
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:
2. Exclusion list Auditing - How to activate/deactivate auditing for a specific table or field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 01:50 AM - edited 08-20-2024 01:57 AM
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:
2. Exclusion list Auditing - How to activate/deactivate auditing for a specific table or field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2024 11:52 PM
Hi
Thanks.. I accept your answer as solution. However, the "setDisableUpdateAudit" i could not find in API.
So I used:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 07:32 AM
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.