Create cleanup scripts
Use cleanup scripts to automate post-clone steps or to modify data after your clone.
Before you begin
Role required: admin
Verify that custom scripts have proper error handling to avoid issues. Without proper error handling, failing customized scripts can help prevent subsequent scripts from executing.
Note: After your clone completes, you can monitor the execution status of each cleanup script on the target instance. See Monitor cleanup script execution.
Procedure
-
Navigate to All > Clone Admin Console > Clone Home.
-
Select Configuration from the secondary navigation.
-
Select the Cleanup scripts tab.
-
Select New.
-
Enter a name for your script.
-
Select the order number for your script.
-
Check Active when your script is ready.
-
Enter your script in the Script field, and select Save.
Disable emails
To create a cleanup script to disable emails, do the following.
-
Select New on the cleanup scripts tab.
-
Add the name
Disable emails. -
Check Active.
-
In the script field, add
JavaScriptgs.setProperty("glide.email.read.active", false);gs.setProperty("glide.email.smtp.active", false);.
-
Select Update.
What to do next
After your clone completes, go to the target instance to monitor cleanup script execution and retry any failed scripts. See Monitor cleanup script execution.
Cleanup scripts (lists and forms)
Use cleanup scripts to modify data after your clone completes.
Before you begin
Role required: admin
Note: For current versions of the Clone Admin Console, you can monitor cleanup script execution after a clone. See Monitor cleanup script execution.
Procedure
-
Navigate to All > Instance Clone > Clone Definition > Cleanup scripts.
-
Select New.
-
Select the order number for your script.
-
Check Active when your script is ready.
-
Enter your script in the Script field, and select Save.
---
title: Create cleanup scripts
description: Use cleanup scripts to automate post-clone steps or to modify data after your clone.Use cleanup scripts to modify data after your clone completes.
locale: en-US
canonical_url: https://www.servicenow.com/docs/r/australia/platform-administration/create-cleanup-script.html
release: australia
topic_type: task
last_updated: "2026-03-12"
reading_time_minutes: 1
breadcrumb: [Configure, Instance Clone, Configure core features, Administer the ServiceNow AI Platform]
---
# Create cleanup scripts
Use cleanup scripts to automate post-clone steps or to modify data after your clone.
## Before you begin
Role required: admin
Verify that custom scripts have proper error handling to avoid issues. Without proper error handling, failing customized scripts can help prevent subsequent scripts from executing.
**Note:** After your clone completes, you can monitor the execution status of each cleanup script on the target instance. See [Monitor cleanup script execution](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/monitor-cleanup-script-execution.md).
## Procedure
1. Navigate to **All** > **Clone Admin Console** > **Clone Home**.
2. Select **Configuration** from the secondary navigation.
3. Select the **Cleanup scripts** tab.
4. Select **New**.
5. Enter a name for your script.
6. Select the order number for your script.
7. Check **Active** when your script is ready.
8. Enter your script in the **Script** field, and select **Save**.
## Disable emails
To create a cleanup script to disable emails, do the following.
- Select **New** on the cleanup scripts tab.
- Add the name `Disable emails`.
- Check **Active**.
- In the script field, add
```
gs.setProperty("glide.email.read.active", false);gs.setProperty("glide.email.smtp.active", false);
```
.
- Select **Update**.
## What to do next
After your clone completes, go to the target instance to monitor cleanup script execution and retry any failed scripts. See [Monitor cleanup script execution](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/monitor-cleanup-script-execution.md).
## Cleanup scripts \(lists and forms\)
Use cleanup scripts to modify data after your clone completes.
### Before you begin
Role required: admin
**Note:** For current versions of the Clone Admin Console, you can monitor cleanup script execution after a clone. See [Monitor cleanup script execution](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-administration/monitor-cleanup-script-execution.md).
### Procedure
1. Navigate to **All** > **Instance Clone** > **Clone Definition** > **Cleanup scripts**.
2. Select **New**.
3. Select the order number for your script.
4. Check **Active** when your script is ready.
5. Enter your script in the **Script** field, and select **Save**.
| title | Create cleanup scripts |
| description | Use cleanup scripts to automate post-clone steps or to modify data after your clone.Use cleanup scripts to modify data after your clone completes. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/australia/platform-administration/create-cleanup-script.html |
| release | australia |
| topic_type | task |
| last_updated | 2026-03-12 |
| reading_time_minutes | 1 |
| breadcrumb | ConfigureInstance CloneConfigure core featuresAdminister the ServiceNow AI Platform |