A sandbox account in NetSuite is used to create a replica of the production account for development and testing purposes. In general, a sandbox account is a security mechanism for separating running programs, usually in an effort to mitigate system failures or any other vulnerabilities from spreading.
In this use case, Shopify - NetSuite integration app is taken as an example, but this applies to any other integration app.
The NetSuite sandbox account is refreshed to bring the latest data and configurations from the production account into the sandbox account. Refreshing a sandbox account copies all configuration, data, user passwords, and customizations from your production account into the sandbox account. Any changes you have made to the sandbox account are overwritten. After your sandbox account has been refreshed from production, it cannot be restored to its prior state.
After the NetSuite sandbox refresh, you have the following options to revive the integration App:
- Clone the integration app flows: This is the recommended option. To know more about the cloning options, see Clone integration app flows with the template utility.
- Re-install the integration app. To know more about uninstalling and installing the integration app again, see Installation of the Shopify - NetSuite Integration App.
- Revive the same install. This is a time-consuming option that requires many changes in the integration app.
Required steps before sandbox refresh
Perform the following steps before initiating the refresh for your NetSuite sandbox:
- Take a screenshot of all the fields in Settings that display information from NetSuite.
Though the display of values selected for all fields in Settings within the integration app remains unaffected from the sandbox refresh, it is recommended to take a screenshot of every field where you have selected a NetSuite value. After the sandbox refresh, all the fields that display data from NetSuite must be reconfigured. Screenshots of all Setting fields are advantageous when you are reconfiguring values in the integration app after the sandbox refresh.
- Take a screenshot of all Field Mappings for all flows where you have defined a value in the Hard-Coded and Lookup field within the Settings window against a mapping. Screenshots of all Field Mappings are advantageous when you are reconfiguring mappings in the integration app after the sandbox refresh.
- Make a list of all NetSuite custom fields that you are using from NetSuite within Field Mappings against all flows.
Required steps after a sandbox refresh
Perform the following steps to revive your Integration App post sandbox refresh.
- Turn off all flows.
Click the Off/On button against all integration flows in every section, that are in the On state.
- Reconfigure all saved searches
Refresh and re-select a saved search to link the saved search being displayed in the integration app with the saved search from your production account. Without refresh, the saved search displayed in the integration app always points to the internal ID of the saved search belonging to the sandbox account before the refresh. When you refresh the drop-down list for any saved search, it updates the internal IDs associated with the saved search as per the production account.
Note: All saved searches existing in NetSuite hold a unique internal ID with them. A saved search with the same name in production and sandbox will always have a separate internal ID associated with them.
Refreshing the drop-down list ensures that the saved search being used in the integration app is referring to the internal ID of the saved search in a production environment.To ensure the right saved search is being used, you are required to perform the following steps:
- In Settings, click the Refresh icon against the saved search drop-down list.
- Select the appropriate saved search from the saved search drop-down list.
- Click Save.
- Repeat the above steps for all the saved searches present in the Integration App.
- Reconfigure all the fields in Settings that display information from NetSuite.
Any field in the integration app that displays information from NetSuite, needs to be refreshed before executing the 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 associated internal IDs in NetSuite are stored in the following manner:
When you select the USA from the drop-down list and run a flow, the integration app will always refer to the internal ID 1 that is listed against currency: USA.
Now, assume that the currency information in the NetSuite production account is stored in the following manner:
Internal ID Name 4 USA 3 British pound 2 Canadian dollar 1 Euro
Perform the following steps to refresh and reselect the value:
- In Settings, click the Refresh icon against the field.
- Select the appropriate value from the drop-down list.
Note: You can refer to the screenshots you have taken in step 1 of the Required steps before a sandbox refresh section to identify the value that you need to select from the drop-down list.
- Click Save.
- Repeat the above steps for all the saved searches present in the integration app.
- Re-configure Field Mappings with values in the Hard-Coded and Lookup field.
You are required to reselect the value in the Hard-Coded or Lookup field from the Settings window for all the Field Mappings against all flows where you have defined value in the Hard-Coded and Lookup field.
- Click the Field Mappings icon against integration flow. The Mappings window is displayed.
- Click the Settings icon against the mapping to open the Settings window.
- Select Hard-Coded or Lookup field.
- From the Import Field (NetSuite) drop-down list, reselect the value you wish to assign against Export Field.
Note: You can refer to the screenshots you have taken in step 2 of the Required steps before sandbox refresh section to identify the value that you need to select from the drop-down list.
- Click Save.
- Repeat the above steps for all similar field mappings.
- Recreate the NetSuite custom fields and configure them in Field Mappings
When a sandbox account is refreshed, any custom field that was created in the sandbox account and not in production is overwritten with production data. You need to ensure that all the custom fields that you are using from NetSuite within Field Mappings also exist in the refreshed sandbox account.
Once you have ensured that all such custom fields are also existing in the refreshed sandbox account, you must re-select all the custom fields in Field Mappings to ensure that the internal IDs associated with the custom fields are referring to the custom fields that belong to the sandbox account after the refresh (production account data).
Note: You can refer to the list of all custom fields you have created in step 3 of the Required steps before a sandbox refresh section to identify the mappings against which you need to reselect the new custom fields.
Update Account ID in sandbox environment:
A combination of one EXTERNAL ID PREFIX and ACCOUNT ID is generally used to run various 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 will be replaced with the external ID and the account ID of the record in the production environment.
The EXTERNAL ID PREFIX is a non-editable field. The ACCOUNT ID of the record for the sandbox environment needs to be updated to the ACCOUNT ID used for creating the EXTERNAL ID PREFIX and ACCOUNT ID combination, when the integration app was initially installed for the sandbox environment. If this action is not completed, you will not be able to run the integration flows successfully.
- Run 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 account are connected to the different stores, you are required to run the Shopify Product Id to the NetSuite Item Mass Update flow.
To know more about the Shopify Product Id to NetSuite Item Mass Update flow, see Inventory.
Note: You are not required to run this flow when both of your sandbox and production accounts are connected to the same store.
- Re-establish 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, you must create tokens in that sandbox. Each time your sandbox is refreshed, you will need to create new tokens in the sandbox. If you are using 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 on how to establish a token-based authentication connection, see How to change NetSuite Connection from Basic to Token?.