How to Create a Salesforce Sandbox for Portal Testing
A Salesforce sandbox is a copy of your org for development and testing. Connect the portal to a sandbox to try out pages, forms, roles and workflows without affecting live data. When everything works, switch the portal to your live org.
Before you start
- You need access to Salesforce Setup for your production org.
- Your org needs an available sandbox of the type you want. If you don’t see a sandbox option, or you need more licenses, contact Salesforce to order sandboxes for your org.
- For a Partial Copy sandbox, create a sandbox template first to choose which data to copy.
Create the sandbox in Salesforce
-
In Salesforce, open Setup.
-
In the Quick Find box, enter
Sandboxes, then select Sandboxes. -
Select New Sandbox.
-
Enter a name of 10 characters or fewer, and a description.
-
Select the type of sandbox you want.
-
For a Partial Copy or Full sandbox, select Next and choose the data to include (see the table below).
-
Optional: to run scripts after each create and refresh, specify the Apex class you created from the
SandboxPostCopyinterface. -
Select Create.
Tip: Choose a short name that reflects the sandbox’s purpose, such as
QA. Salesforce appends the sandbox name to usernames in the sandbox, so a short name makes sandbox logins easier to type.
Choose the data to copy
| Sandbox type | What to select |
|---|---|
| Partial Copy | The sandbox template you created to specify the data for this sandbox. |
| Full, template-based data | An existing sandbox template. |
| Full, all data | Whether and how much field tracking history to include, and whether to copy Chatter data (feeds, messages and topics). |
Copying less data can make the sandbox copy much faster.
Note: If you reduce the number of sandboxes you buy, the sandboxes you have must match the number you bought. For example, if you have two Full sandboxes but bought only one, you can’t create a Full sandbox. Convert a Full sandbox to a smaller type, such as Developer Pro or Developer, instead.
Prepare the sandbox for the portal
- Check that the portal’s connected app is available in the sandbox org. If it is not, create it there. See How to Set Up a Salesforce Connected App for the Portal.
- Sandbox usernames end with the sandbox name, for example
user@example.com.qa. Use the sandbox username and that user’s sandbox security token. - Salesforce adds
.invalidto user email addresses in a new sandbox. Correct the email address of the user the portal connects as, so that user can receive the security token.
Connect the portal to the sandbox
- In the portal admin, go to Settings → Portal Settings → CRM Authentication.
- Enter the OTP sent to the super admin’s registered email address.
- In Environment, select Sandbox.
- Enter the connection details for your sandbox org.
- Select Save.
For the full steps, see How to Switch the Portal Between Sandbox and Live CRM.
Note: When you connect the portal to a different org, you can preserve or reset the existing portal data. See How to Preserve or Reset Portal Data After Reconnecting before you switch.
Related articles
- How to Switch the Portal Between Sandbox and Live CRM
- How to Set Up Salesforce JWT Authentication for the Portal