Sub topic 13
Running a refresh step by step
This chapter assumes you have read the previous chapter on what a refresh does. You should also have a backup of any work that exists only in the sandbox. Here you will run the refresh from Setup.
Before you start
Check these three things first:
- The refresh interval for the sandbox type has passed. If it has not, the Refresh link is unavailable.
- Any changes you want to keep have been deployed or saved elsewhere.
- You have the Manage Sandboxes permission, or you are a System Administrator.
The refresh steps
- In the source org, open Setup and search for Sandboxes. Open the list under Environments.
- Find the sandbox in the list and click Refresh in its Action column.
- Review the name and description. You can edit the description, but the name stays the same.
- Choose the sandbox type. You can usually keep the current type or pick another type your licenses allow.
- If the type is Partial Copy, choose a sandbox template, because Partial Copy needs one. For a Full sandbox, a template is optional. Also choose how much data to copy and whether to include field tracking history and Chatter data.
- Optionally, enter the name of a
SandboxPostCopyApex class. Salesforce runs it after the copy finishes. - Click Next, review the summary, and click Create.
The sandbox status changes to Pending, then Processing. Salesforce emails you when the copy is ready. Large Full sandboxes can take many hours or longer, so plan for that.
Activation
The refresh builds a new copy in the background. Your existing sandbox stays available until you activate the new one. When the status shows Completed, the Action column offers an Activate link.
Activating the new copy deletes the old sandbox, including any changes made there since the refresh began. Finish or move any last work before you click it.
If you leave the new copy waiting, Salesforce may activate it automatically after a period of time. Do not rely on the old sandbox lasting indefinitely.
Check the result
After activation, confirm the following:
- You can log in. Usernames in the sandbox get the sandbox name appended, for example
[email protected]. - The post-copy class ran. Check the debug output or the data it was meant to change.
- Integration endpoints, email deliverability, and scheduled jobs are as you expect. The next chapter covers these in detail.
Common errors
| Symptom | Likely cause |
|---|---|
| Refresh link is greyed out | The refresh interval has not elapsed |
| Partial Copy refresh cannot continue | No sandbox template was selected |
| Post-copy class did not run | The class name was wrong, or the class does not implement `SandboxPostCopy` |
| Cannot log in with the old username | The sandbox name suffix is missing from the username |
Exercise
You start a refresh of a Developer Pro sandbox on Monday. On Tuesday a teammate commits a fix directly in that sandbox. The status on Wednesday is Completed. What should you do before you click Activate, and why?
Show answer
Retrieve or deploy the teammate's fix from the old sandbox to source control or another org before activating. Until you activate, the old sandbox still exists, but activation replaces it with the new copy and deletes everything in the old one, including the fix.