A sandbox account in NetSuite is a replica of your production account that you use for development and testing. In general, a sandbox account is a security mechanism for separating running programs, usually to keep system failures or other vulnerabilities from spreading. Refreshing a sandbox account copies all configuration, data, user passwords, and customizations from your production account into the sandbox account. Any changes you made to the sandbox account are overwritten, and after the refresh you cannot restore the sandbox account to its prior state. This article explains what to do before and after a NetSuite sandbox refresh so that your integration app keeps working. The steps use the Shopify - NetSuite integration app as an example, but the process applies to any integration app.
For more information about NetSuite sandbox refreshes, see the following NetSuite documentation:
Options to revive your integration app
After the NetSuite sandbox refreshes, you have the following options to revive the integration app:
- Clone the integration app flows: This is the recommended option. For the cloning options, see Clone your integration app configuration.
- Reinstall the integration app: For uninstalling and installing the integration app again, see the installation article for your integration app (for example, Installation of the Shopify - NetSuite Integration App) and Uninstall your integration app.
- Revive the same install: This option is time-consuming and requires many changes in the integration app.
Required steps before a sandbox refresh
Before you start the refresh of your NetSuite sandbox, complete the following steps:
- Take a screenshot of all the fields in Settings that display information from NetSuite. The values selected for the fields in Settings remain unaffected by the sandbox refresh, but after the refresh you must reconfigure all the fields that display data from NetSuite. The screenshots help you reconfigure the values in the integration app after the refresh.
- Take a screenshot of all field mappings for all flows where you defined a value in the Hard-Coded or Lookup field in the Settings window against a mapping. The screenshots help you reconfigure the mappings in the integration app after the refresh.
- Make a list of all NetSuite custom fields that you use from NetSuite in field mappings across all flows.
Required steps after a sandbox refresh
To revive your integration app after a sandbox refresh, complete the following steps.
Turn off all flows
Select Off/On against every integration flow, in every section, that is in the On state.
Reconfigure all saved searches
Refresh and reselect each saved search to link the saved search displayed in the integration app with the saved search from your production account. Without a refresh, the saved search displayed in the integration app always points to the internal ID of the saved search that belonged to the sandbox account before the refresh. When you refresh the list for any saved search, the internal IDs associated with the saved search update to match the production account.
Note: All saved searches in NetSuite have a unique internal ID. A saved search with the same name in production and sandbox always has a separate internal ID.
To make sure the integration app uses the right saved search:
- In Settings, select Refresh next to the saved search list.
- Select the appropriate saved search from the list.
- Select Save.
- Repeat these steps for all the saved searches in the integration app.
Reconfigure all Settings fields that display NetSuite information
Any field in the integration app that displays information from NetSuite needs a refresh before you run a flow. When you select a NetSuite value in the integration app, the integration app always refers to the internal ID of the selected value.
For example, assume the currency information and internal IDs in your NetSuite sandbox account are stored so that USA has the internal ID 1. When you select USA from the list and run a flow, the integration app always refers to the internal ID 1 that is listed against the currency USA.
Now assume that the currency information in the NetSuite production account is stored as follows:
| Internal ID | Name |
|---|---|
| 4 | USA |
| 3 | British pound |
| 2 | Canadian dollar |
| 1 | Euro |
After the sandbox refresh, if you do not refresh and reselect the value in the field, the integration app reads the currency to process as Euro instead of USA, because the internal ID 1 in the production account points to Euro. When you refresh the field, all internal IDs are remapped against the value displayed in the field. After the refresh, when you reselect USA, the integration app refers to the internal ID of USA, which is 4.
To refresh and reselect the value:
- In Settings, select Refresh next to the field.
- Select the appropriate value from the list. To identify the value to select, refer to the screenshots you took in the first step of the required steps before a sandbox refresh.
- Select Save.
- Repeat these steps for all the fields in Settings that display information from NetSuite.
Reconfigure field mappings with Hard-Coded and Lookup values
Reselect the value in the Hard-Coded or Lookup field in the Settings window for all the field mappings, across all flows, where you defined a value in the Hard-Coded or Lookup field.
- Select Field Mappings against the integration flow. The Mappings window opens.
- Select Settings against the mapping to open the Settings window.
- Select the Hard-Coded or Lookup field.
- From the Import Field (NetSuite) list, reselect the value you want to assign against the export field. To identify the value to select, refer to the screenshots you took in the second step of the required steps before a sandbox refresh.
- Select Save.
- Repeat these steps for all similar field mappings.
Recreate NetSuite custom fields and configure them in field mappings
When a sandbox account is refreshed, any custom field that you created in the sandbox account and not in production is overwritten with production data. Make sure that all the custom fields you use from NetSuite in field mappings also exist in the refreshed sandbox account.
After you confirm that those custom fields exist in the refreshed sandbox account, reselect all the custom fields in field mappings so that the internal IDs associated with the custom fields refer to the custom fields that belong to the sandbox account after the refresh (production account data). To identify the mappings where you need to reselect the new custom fields, refer to the list of custom fields you made in the third step of the required steps before a sandbox refresh.
Update the Account ID in the sandbox environment
A combination of one EXTERNAL ID PREFIX and ACCOUNT ID is generally used to run integration flows at the store level. When a sandbox refresh is performed, the external ID and the account ID for the record in the sandbox environment are replaced with the external ID and the account ID of the record in the production environment.
The EXTERNAL ID PREFIX is not editable. Update the ACCOUNT ID of the record for the sandbox environment to the ACCOUNT ID that was used to create the EXTERNAL ID PREFIX and ACCOUNT ID combination when the integration app was first installed for the sandbox environment. If you do not complete this action, you cannot run the integration flows successfully.
Run the Product Id to NetSuite Item Mass Update flow
The Product Variant ID field in NetSuite creates the link between the NetSuite and Shopify items. When your NetSuite sandbox and production accounts are connected to different stores, run the Shopify Product Id to NetSuite Item Mass Update flow. For more information about this flow, see the Inventory section of the Shopify - NetSuite integration app documentation.
Note: You do not need to run this flow when your sandbox and production accounts are connected to the same store.
Re-establish the token-based authentication connection
Tokens created in your production account are not copied to your sandbox during a refresh. To test token-based authentication (TBA) in your sandbox, create tokens in that sandbox. Each time your sandbox is refreshed, you need to create new tokens in the sandbox. If you use TBA in your primary sandbox and production account, be aware of the following:
- The Token Key and Token Secret are deleted in your primary sandbox account after each sandbox refresh, and you must regenerate them on your primary sandbox account. This has no impact on the Token Key and Token Secret used in your production account.
- The Consumer Key and Consumer Secret are shared between your primary sandbox and production accounts. If you change the Consumer Key or Consumer Secret in your primary sandbox account, auto-install automatically changes them in your production account and can break your production account integrations.
For more information about establishing a token-based authentication connection, see Change your NetSuite connection to token-based authentication.
If the connection to the refreshed sandbox goes offline with an "Invalid login attempt" error, see Troubleshoot NetSuite authentication errors in Fix an offline connection.