+ Start a Discussion
Vipin  PulinholyVipin Pulinholy 

Sandbox Refreshed Date on Sandbox

Hi- I would like to know if there is any ways to find the when the sandbox got refreshed from the Sandbox itself. I know we can see the history in Production. But we have developers working who don't have production access and want to know the date of the last refresh.

Any idea?

Thanks

Satish_SFDCSatish_SFDC
I dont think there is any way to know the Sandbox refresh date from the sandbox itself. 
The only way would be to to check in the Production.

Regards,
Satish Kumar
Raj VakatiRaj Vakati
Hi  Vipindas ,
You cannot refresh sandbox from sandbox . Only you can migrate metadata from one sandbox to other sandbox
sales force 48sales force 48
Hi Vipindas,

We cannot see the details on the sandbox where this is still under Salesforce Ideas, Please check in below link and try to comment for faster implementation by salesforce.

REF LINK : https://success.salesforce.com/ideaView?id=08730000000l8AyAAI

Regards,
Srikanth
Patrick Watkins 7Patrick Watkins 7

FYI, I posted to the idea as well, but found a decent workaround which involves running this query:
Select createddate from SetupAuditTrail order by createddate desc limit 1
That gives you the first time something was DONE in your sandbox from a setup standpoint (password reset, development, etc.), which is often what you need.  Agree the idea is still needed though for other use cases:

https://success.salesforce.com/ideaView?id=08730000000l8AyAAI

Rem BrandRem Brand
Thanks Patrick was looking for something like this! You'd want to use asc instead of desc though if you want the oldest/first record. Final remark here is that this will only work if this date was within the last 6 months, since this log is limited.
Kr,
Remco
Jon-FreedJon-Freed
Great idea, @[Patrick Watkins 7].

If you want to see who has logged into your sandbox since a change was made in the sandbox, then here are two SOQL statements that expand on that SOQL.  Just take the date from the first and plug it into the second.  
SELECT CreatedDate FROM SetupAuditTrail ORDER BY CreatedDate DESC LIMIT 1

SELECT LastLoginDate, Username, Email FROM User WHERE LastLoginDate >= 2001-01-01T00:00:00.000+0000 ORDER BY LastLoginDate Desc
If you use sfdx with the bash shell, then try the following command that automatically plugs the date from the first query into the second.  (It uses the active sfdx default username.)
echo ""; sfdx force:data:soql:query -q "SELECT LastLoginDate, Username, Email FROM User WHERE LastLoginDate >= $(sfdx force:data:soql:query -q 'SELECT CreatedDate FROM SetupAuditTrail ORDER BY CreatedDate DESC LIMIT 1' | grep -E -o '(\d{4}.*?\d{4})') ORDER BY LastLoginDate Desc"; echo "";
If you just want those people's email addresses so you can email them, then try this derivative, but keep in mind that sandbox users' email addresses may not be completely accurate:
echo ""; sfdx force:data:soql:query -q "SELECT Email FROM User WHERE LastLoginDate >= $(sfdx force:data:soql:query -q 'SELECT CreatedDate FROM SetupAuditTrail ORDER BY CreatedDate DESC LIMIT 1' | grep -E -o '(\d{4}.*?\d{4})') ORDER BY LastLoginDate Desc" | grep @ | tr '\n' ', '; echo ""; echo ""
Govind GovindGovind Govind
Hi Vipin Pulinholy,

We can find the Sandbox Refresh date using SOQL.
Please use  following query 

SELECT Name,IsSandbox, LastModifiedDate FROM Organization

Based on LastModifiedDate we can predict.

Please make this as best answer. So its helps for  others.

Thanks