Salesforce sandboxes are essential for development, testing, and staging changes before deploying them to production. However, one common challenge is determining when a sandbox was last refreshed. Unlike other metadata details in Salesforce, this information is not available directly in the sandbox itself. Instead, you must query specific Salesforce objects using SOQL.
I will walk you through the process of retrieving the last refresh date of a sandbox and identifying when a Salesforce production org was created.
You can also read – https://sfdc247.com/2020/03/salesforce-release-management-and-version-control-branching-strategy.html
Where to Run the Query: Production or Sandbox?
To find the last refresh date of a sandbox, you must run the query in your Production Org. The reason is that Salesforce does not store sandbox metadata inside the sandbox itself. Instead, Production maintains all sandbox-related details.
Step 1: Querying SandboxInfo
for Basic Sandbox Details
The SandboxInfo
object provides high-level information about your sandboxes, including their names, descriptions, and creation dates.
Run this SOQL query in Salesforce Developer Console (in Production):
SELECT Id, SandboxName, Description, SourceId, CreatedDate
FROM SandboxInfo
ORDER BY CreatedDate DESC
Fields Explained:
- SandboxName – The name of the sandbox.
- Description – A description of the sandbox.
- SourceId – The ID of the org the sandbox was cloned from (if applicable).
- CreatedDate – The date when the sandbox was originally created.
Limitation: This query does not provide the last refresh date.
Step 2: Querying SandboxProcess
for Refresh Date
To retrieve the last refresh date, you need to query the SandboxProcess
object. This object stores every sandbox creation and refresh process, including status updates.
Run this SOQL query in Salesforce Developer Console (in Production):
SELECT Id, SandboxName, Status, StartDate, EndDate
FROM SandboxProcess
ORDER BY EndDate DESC
Fields Explained:
- SandboxName – The name of the sandbox.
- Status – The status of the sandbox refresh (
Completed
,Pending Activation
, etc.). - StartDate – The date and time when the sandbox refresh started.
- EndDate – The date and time when the refresh process was completed (use this as the last refresh date).
Key Takeaway: The EndDate
field in SandboxProcess
represents when the last sandbox refresh was completed.

Step 3: Running the Query via API (Alternative Method)
If you prefer using an API instead of Developer Console, you can retrieve the data using the Salesforce REST API.
REST API Request (cURL Command)
curl -X GET \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
"https://YOUR_INSTANCE.salesforce.com/services/data/v60.0/query?q=SELECT+Id,SandboxName,Status,StartDate,EndDate+FROM+SandboxProcess+ORDER+BY+EndDate+DESC"
Replace YOUR_ACCESS_TOKEN
with a valid Salesforce API token and YOUR_INSTANCE
with your Salesforce instance URL.
Step 4: Finding When a Production Org Was Created
If you need to determine when a Salesforce production org was created, you can query the Organization
object.
SOQL Query for Production Org Creation Date
SELECT Id, Name, OrganizationType, InstanceName, CreatedDate
FROM Organization
Fields Explained:
- CreatedDate – The date when the production org was created.
- OrganizationType – The type of Salesforce org (
Production
,Sandbox
,Developer Edition
, etc.). - InstanceName – The instance where your org is hosted.

Summary
Action | Object to Query | Key Fields |
---|---|---|
Find Sandbox Basic Info | SandboxInfo |
SandboxName , CreatedDate |
Find Last Refresh Date | SandboxProcess |
SandboxName , EndDate |
Find Production Org Creation Date | Organization |
CreatedDate |
By following these steps, you can quickly determine the last refresh date of a sandbox and the creation date of a production org in Salesforce. Running these queries in Production ensures accurate and up-to-date information.
Also Read – https://sfdc247.com/2020/06/flosum-vs-autorabit-vs-copado-the-best-salesforce-devops-release-management-tool.html
If you have any questions regarding Salesforce DevOps, I can guide you and clear all your doubts. you can always comment and contact me from our contact us page we will try to answer your queries as soon as possible and in case you have any suggestion on how to improve my website page, do reach out to me.
We also write product reviews on the tools and if you have any product that you would like to get reviewed you can always comment, contact me via Contact Us Page and I will reply back you immediately
#Note: Publishing this content anywhere without the consent of SFDC247 will result in a lawsuit against copyright infringement
One Comment