Dynamics CRM On-premise Sandbox Instances

Jared Johnson, 22 June 2014

This year new functionality was added to Dynamics CRM Online called Sandbox instances. This added administration features around creating test instances, and also had a nice effect of changing the colour of the navigation to orange and displaying SANDBOX at the top of the screen. This insures users know that they are in a non-live system, and don’t accidentally make changes they intended for the sandbox system in production.



The SANDBOX text also changes to bold when clicked on for some reason

If you are using CRM on-premise, there is no current way to create a sandbox instance in the same way as online. However if all that is needed is the sandbox colouration, then from CRM 2013 Rollup 2, we can simply enable displaying the sandbox theme client-side, note this is unsupported.

To do this we need to edit the main.aspx file on the CRM server, this is most likely located at C:\Program Files\Microsoft Dynamics CRM\CRMWeb\main.aspx. In the head section of main.aspx, after the title tag we add this script tag:

<script>
        var IS_SANDBOX_ORG = true;
</script>

Setting IS_SANDBOX_ORG to true is all we need to trigger the display of the sandbox theme to users, however if there are multiple CRM organisations running on this server then this will take effect for all of them.

If we only want this to apply to certain organisations we can then add an if check using the ORG_UNIQUE_NAME variable. You can get the correct value of this going to:

Settings->Customizations->Development Resources in CRM and grabbing the Organization Unique Name value. 

<script>
    if (ORG_UNIQUE_NAME == "Test") {
        var IS_SANDBOX_ORG = true;
    }
</script>

Now only the Test organisation will display as a sandbox instance.