How to refresh a sandbox

How to refresh a sandbox

Sometimes a Sandbox will become out of sync with the production environment and therefore needs to be refreshed in order to be useful for accurate testing.

Run mass update for Contacts and Users, append .testing at the end of every email.

Step-by-step guide

The following steps must be followed in order to refresh a Salesforce Sandbox Org to mirror the latest state of a Production Org.

  1. From within the Production Org, select Setup >> Deploy >> Sandboxes

  2. The list of Sandboxes will display, with the ones you can refresh having a Refresh link next to the Sandbox name. Click the Refresh button next to the Sandbox you would like to update

  3. If you want to activate your sandbox immediately after you refresh it, select Auto Activate. In this case, you don’t receive an activation email

  4. Salesforce will start copying data to the Sandbox, and display a status

  5. Once complete the In-Progress link next to the Sandbox name will change to Activate, and an email notification will be sent from Salesforce

  6. When ready select the Activate link. Note: The Sandbox needs to be activated before the refreshed data can be used. Activating a replacement sandbox that was created using the Refresh link, completely deletes the sandbox it is refreshing, and all configuration/data in the previous Sandbox will be lost.

Post refresh

After a sandbox has just been refreshed, it needs to be returned to its previous functional state to use for testing.

Step-by-step guide

The following steps must be followed in order to change all reference points after a refresh.

  1.  Update Payment Gateway(s) 

    1. When Creating a Test Payment Gateway make sure to use a Test Deposit Account 

    2. Locate all business groups that are connected to a live payment gateway(s) (App Launcher → Administrator app → Business Group tab). See Figure 1.

    3. within each Business Group delete the related gateways and create test gateway(s). See Figure 2.

    4. Go to the Stores Object, and update all Stores being used with the new payment gateway. See Figure 3.

    5. Make sure to add an "X" prefix to the Payment Gateway if you are going to disable one. ( ROE process picks the first gateway alphabetically without checking if it is enable )
      We need to make that change because trying to delete the Payment Gateway throws the following error: 'Cascade dereferencing too many records: occurring when cascading to Receipt records'

Figure 1

       

Figure 2.

Figure 3.

  1. Store

    1. Go to Related List

    2. Payment Methods

      1. Make sure the Test Gateway is assigned to each one

  2. Business Group

    1. Make Sure it's using a Test Deposit Account

  3. Recreate Scheduled Job(s)

    1. Navigate to Setup → Jobs → Scheduled Jobs

    2. Delete previously scheduled job(s) and reschedule them again if they need to continue running in the future

  4. Check routing rules

    1. Go to the Fonteva Framework tab → Routing Rules and make sure that the "Is Enabled" checkbox are correct. For example, if refreshing a Sandbox from Production, chek that any routing rule enabled in production are enabled in the sandbox, and that any routing rule not enabled in production is also not enabled in the sandbox.

  5. Update Theme(s)

    1. Navigate to the Site(s) object → click on Site Name

    2. Verify Site is using the correct theme, if not update

    3. Navigate to the Business Groups object, and open each Business Group record

    4. If a Theme is referenced from within the Business Group, open the theme and then update the Logo URL

  6. Update Custom Label(s)

    1. Navigate to Setup → Build → Create → Custom Labels

    2. Select the Edit link next to each Custom Label (Note: You can identify the custom labels to update because they will show a Del option in the Action column. See Figure 1

    3. Once on the edit screen, update the URL listed in the Value field to reconnect to the appropriate portal site. See Figure 2

      Figure 1

      Figure 2

  7. Add/Update Remote Site Setting
    Note: Before any Apex callout can call an external site, that site must be registered in the Remote Site Settings page, or the callout fails.í«í_

    1. Navigate to Setup → Administrator → Security Controls → Remote Site Settings

    2. Click button for New Remote Site or Edit beside the previously created Remote Site. Change as necessary to point to the appropriate URLs

  8. Update Community Logout URL

    1. Type in All Communities from the Quick Find, select the All Communities link, click Manage next to the Community Site name

    2. Once in Community Management, click Administration → Login & Registration

    3. Enter the correct URL for the logout page under the section Logout

  9. Verify Site & Menu Items URLs

    1. Go to > Setup > search All Sites

      1. go to

      2. Related

      3. Community Menu Items

      4. Check that each Community Menu Item external url is pointing to the right Org

  10. Publish the Communities

    1. Go to > Setup > search All Sites

      For each of the Active Communities enter:

      1. Builder

      2. Publish

      3. Accept

  11. Modify URL Site(s) Redirects

    1. Type in All Communities from the Quick Find, select the All Communities link, click Manage next to the Community Site name

    2. Once in Community Management, click Administration → Pages → Go to Force.com

    3. On the Site Details page, click the URL Redirects button, and update as needed

  12. Update links on Site(s) Record(s)

    1. Navigate to the Sites object, and select the Site Name to open the Site record.

    2. Update all URLs under the Links section.

      • Site URL

      • User Login URL

      • Login Redirect URL

      • User Reset Password URL

      • User Self Registration URL

      • Profile Page URL

  13. Run File Level Security (FLS)

    1. Go to Spark Framework >> Dashboard >> Access Manager

    2. Run FLS in Access Manager for all profiles that will be used for testing, but exclude CPBase

  14. Update Community Groups and Member Records

    1. Navigate to the Community Groups object. On all Community Group records complete the following updates:

      1. Unpublish (Is Published = False) and delete Chatter Group ID

      2. Update the Look up to the correct Site on all community groups, click Save

      3. Select Edit, and check the box for Is Published which will auto-populate the Chatter Group ID

    2. Within each Community Group Detail page, navigate to the Community Group Members related list. Open each member's record and complete the following:

    3. Delete Chatter Member ID

      1. Update Role to Deactivated (Is Active = False)

      2. Do a mass update and make Role = Active. This will populate the Chatter Group Member ID