Sandbox Refresh Steps
Refreshing a sandbox may require additional steps for Breadwinner for NetSuite. If you do not want to connect or use Salesforce sandbox to your production NetSuite account, you will need to delete the existing Breadwinner for NetSuite data from your sandbox. Follow the steps below to complete this process.
- Visit the Breadwinner Tab - this will remove the production credentials and Netsuite Object configuration.
- Assign the Admin Breadwinner Permission Set to the user that is going to sync the data (Needs to be a user with the Salesforce Admin profile)
- Optional - Delete production data—During a refresh, Salesforce pulls in production data, including those in our custom objects (Customers, vendors, Sales Orders, Invoices, etc.). This is optional, but it should be done to limit confusion and for security reasons.
- Breadwinner setup tab -> Troubleshoot -> General
- Open up the "Delete NetSuite Data in Salesforce" Section
- Select the 'OTHERS' Tab (This may be your only option)
- Delete all the records—Salesforce limits us to deleting 10K records per click.
- See the "Delete Production NetSuite data from the sandbox" section below if you have a large amount of data.
- Connect to the NetSuite Sandbox
- Configure NS Object Sync to match production (these records were deleted in Sandbox Step 1).
- Optional: Use the Additional Where filter script below to add "additional where filters" to the NetSuite Object Record.
- For companies with large amounts of data, this will help with the sync time to only pull in 'some' of the data.
- Click the "Start Syncing NetSuite Objects" button on the Breadwinner Setup page.
This will help if you have a large amount of data but don't need all the NetSuite data in your Salesforce sandbox. This will add a date filter so we only bring in the last X days worth of data.
Due to Salesforce limits, you can only delete 10,000 records at a time. Depending on the amount of data, you may also run into DML, CPU, or heap size errors, but rerunning the script over and over will eventually delete all the records.
You cannot delete production subsidiaries using Apex code. To delete production subsidiaries, go to the Breadwinner for NetSuite tab, then click the "Delete NetSuite Subsidiaries" button on the Troubleshoot > General > Delete NetSuite Data in Salesforce > Others tab.
You could also put the above code into a batch apex class that calls itself until all the records are deleted and have it run after the sandbox refresh.