I know it is fairly straightforward in Apex
to determine if the Salesforce instance is production org or a Sandbox org, but I wonder if the same is possible via formula? I have also read What are Salesforce ID's composed of? but it seems to be of little assistance in parsing $Organization.Id
to get the desired information. Every sandbox I have checked was created in a production instance.
Examples with the pod and first 6 characters of their Organization Id
:
cs45 - 00D8A0XXXXXXXXX
cs19 - 00D290XXXXXXXXX
I want to know if it is possible to write a formula that can differentiate org type without any post-refresh steps. I would also like to avoid hard coding any Id
values.
It would be fairly straightforward to create a Hierarchy Custom Setting
and populate the IsSandbox
data into it via a SandboxPostCopy
implementation. Is there no simpler, more reliable way? Admins down the road may forget to run the script.