Determine sandbox name vs production from apex - Ideas - Salesforce Trailblazer Community

All Ideas

Idea Details

Post an Idea
This idea has been merged into another idea. To comment or vote on this idea, please visit Determine sandbox name vs production from apex.
0  Points voting closed
Idea has been posted. Give it an upvote or downvote.

Determine sandbox name vs production from apex

Reports & Dashboards

An earlier idea was reported as "delivered," but it is not.

First, the "solution" was a work-around that may have worked until the "my domain" feature appeared.  It no longer works.

Second, it would be helpful if the sandbox name could actually be determined via Apex--which could also answer the production-or-sandbox idea originally requested.  If the answer is null it's production.  If it's not null, then a sandbox.

· Flag

Latest Comment from Salesforce

  • IdeaExchange Moderator - 4 years ago

    Hi Thomas- here's an update from the Product Manager on the original Idea- I will add this update there too so the folks who voted also get the new info since the solution isn't clear. Then, I will merge this Idea into it.

    If the production organization name is, the sandbox name is acme--<sandboxName>
    It should be even easier to use the "workaround" in the Product Manager comment if you're using mydomain. The URL contains a double-dash if it's a sandbox, and the sandbox name appears after the double dash.
    I think this is all possible with the existing API. There is not an explicit call that says "AmISandboxOrNot", but it can be done.
  • Upvotes
  • Downvotes



from AppExchange


Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.