Cleanup Sandbox
Introduction
In standard Business Central, Microsoft will disable HTTP traffic, Job Queues, and Entra applications when creating a sandbox from production. However, this still leaves a lot of other information that clients may desire to remove for privacy, integration, capacity, or other reasons. Users may also want to replace or delete specific data in Sandbox for testing purposes.
Feature Details
The Cleanup Sandbox tool allows administrators and implementation consultants set up fields or tables that need to be updated or deleted when a Sandbox environment is created from another environment. The tool can also be used in an existing Sandbox environment to to update/delete data. The main benefits of this tool include:
- Data Privacy: Remove sensitive data from the Sandbox environment.
- Protect Production Systems: Update endpoints to prevent accidental data updates to a production system from a sandbox.
- Reduce Capacity Requirements: Automatically delete data that is not needed in the Sandbox environment to free up space. Note: the tool has a hard limit of 3 million records per table to prevent performance issues. Consider the Bulk Delete tool for larger tables, which must be triggered after copying the environment.
The Cleanup Sandbox Setup allows you to:
- maintain a list of tables and fields in a production environment where you want to perform a cleanup automatically while copying the environment.
- specify whether the tool should delete all table data or only update/clear specific fields.
You can only use this feature if you have an Essentials license.
We have made all efforts to ensure Cleanup Sandbox does not cause errors during the Sandbox refresh process. Sometimes, unforeseen issues can stem from a combination of extensions and/or configurations that would prevent the Sandbox refresh from completing correctly. It is possible to disable this feature simply by disabling it in the Cleanup Sandbox Setup.
You access the Cleanup Sandbox by searching for Cleanup Sandbox Setup.
Enabling and configuring Cleanup Sandbox
Before you can configure Cleanup Sandbox, you need to enable it:
You can then configure Per Company and Per Database tables/fields via the actions menu:
Cleanup Company Fields
Cleanup Company Fields defines where the app must update company-specific information. You must specify this separately in each company for each table/field.
There are three modes of use:
Field Cleanup:
- Select table and field
- Set Cleanup Action
- Field will be blanked out when creating Sandbox
Field Modify:
- Select table and field
- Set Modify Action
- Set valid New Value (value is tested against the field type and size)
- Field will be set to New Value when creating Sandbox
Table Cleanup:
- Select table
- Leave Field ID as 0
- Set Cleanup Action
- All records in the table will be deleted when creating Sandbox
Cleanup DB Fields
Cleanup DB Fields defines which information is common to all companies and will be updated when Sandbox gets created. This has to be specified only once for each company. Otherwise, this is functionally identical to Cleanup Company Fields above.
Limitations
Cleanup Sandbox can only handle fields of the following types:
- Boolean:
- Modify allowed values: true, false, 0, 1
- Cleanup value: false
- Code:
- Modify allowed values: any Text or Code value up to field length
- Cleanup value: blank ('')
- Date:
- Modify allowed values: any Text that can be evaluated as Date
- Cleanup value: blank Date (0D)
- DateTime:
- Modify allowed values: any Text that can be evaluated as DateTime
- Cleanup value: blank DateTime (0DT)
- Duration:
- Modify allowed values: any Text that can be evaluated as Duration
- Cleanup value: blank duration (0)
- Integer:
- Modify allowed values: any Text that can be evaluated as an Integer
- Cleanup value: zero (0)
- BigInteger:
- Modify allowed values: any Text that can be evaluated as BigInteger
- Cleanup value: zero (0)
- Text:
- Modify allowed values: any Text or Code value up to field length
- Cleanup value: blank Text ('')
- Time:
- Modify allowed values: any Text that can be evaluated as Time
- Cleanup value: blank Time (0T)
- GUID:
- Modify allowed values: any Text that can be evaluated as GUID
- Cleanup value: blank GUID 00000000-0000-0000-0000-000000000000
Logs
Once Sandbox has been refreshed or manual cleanup has been initiated, the results can be seen on the pages Cleanup Company Log and Cleanup DB Log. A status of Skipped indicates that the app could not make the change. Under such circumstances, the "Skip Reason" field will provide an explanation for why the change was bypassed. The possible reasons include:
- The Table or field does not exist - may happen if the configured table belongs to an extension that was since uninstalled
- User does not have read and write permission to table - may happen due to license or permission set limitations
- Field does not satisfy the requirements:
- does not exist
- is a FlowField or FlowFilter
- is not one of the supported data types see Limitations above
- is named Coupled to CRM - reserved field for CRM/Dataverse integration
- New Value is too long for the target Text or Code field
- There are 3,000,000 records or more in the table - huge tables are skipped for performance reasons