We are planning to refresh our DEV Sandbox (Used for Integration Testing) from Prod.

I am trying to identify impacted areas and how I can address those post refresh

One of the identified areas - User Management

There are many developers who don't have PROD access. They exist only on Sandbox. Post refresh these users will be deleted. So

  1. How can I identify all users who exist on sandbox and not in Prod?
  2. Once identified is there a way to automate user creation of identified users not existing on Sandbox? (Post Refresh)

Thank you for your reply... I am still evaluating what will be the best approach for us to overcome these challenges...Other challenges I am facing are as below

  • The sandboxes we are targeting to refresh are DEV Sandboxes, hence all the data came through integrations as well as manually seeded data for testing will be wiped out. Data available through integration (for Account and contact) can be brought again but manually seeded data (for other objects) has to be restored using data loader (possibly through CLI)

  • Consumer key for connected system also gets updated, hence the integrations will be impacted. The new consumer key for the connected systems has to be declared again on their side. For example we have connected APP for CPQ

  • we have SSO implemented , there is an impact on it as well

  • SandboxPostCopy interface seems redundant for my use case as data in any case has to be imported using dataloader

  • So email anonymisation/invalidation can be handled by modifying CSVs directly

Please let me know if I am thinking on the right lines, any suggestion is more than welcome

  • I am fairly new to stack exchange, hence not very clear how to put follow-up comments etc. For this question I wanted to put a comment but it has space limits, hence I edited my initial post. Hope this is fine. Feel free to suggest what is the proper way of doing follow-ups – Abhishek Verma May 31 '19 at 5:12

I believe the easy way to archive it is creating a Script After Sandbox Creation and Refresh. You can use this script to create the users

Here is the documentation: https://releasenotes.docs.salesforce.com/en-us/spring16/release-notes/rn_deployment_sandbox_postcopy_script.htm

Another approach that I already have done is creating a Profile in Prod called Developer. This profile does not have any access. So, I use the Script after Sandbox Creation and Refresh to update the Profile of these users to Admin.

| improve this answer | |

Once the sandbox refresh starts, you'll have no automated way to know which Users are being wiped out as the SandboxPostCopy interface runs after the sandbox is created

So, as with @mpeixoto answer, you'll need to recreate those users in the sandbox by implementing an apex class that supports the SandboxPostCopy interface. This class can read a static resource (Csv, json, ...) of Users you need to rebuild. Said static resource is maintained in PROD (as it will be copied to the sandbox on sandbox creation).

I'd go with the json approach as you can create the JSON by using the REST API to build a JSON array of User sobjects that can be readily deserialized into insertable sobjects by the sandboxPostCopy class.

| improve this answer | |
  • Thank you for your reply... I am still evaluating what will be the best approach for us to overcome these challenges – Abhishek Verma May 31 '19 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.