Find your content:

Search form

You are here

Determine Salesforce instance from Organization Id reported in unhanded exception email


How can I determine which Salesforce instance sent an unhandled exception email based on the contents of the email?

The Organization Id (keyprefix 00D) and User Id (keyprefix 005) are at the start of the email body. E.g.

Apex script unhandled exception by user/organization: 00540000000000F/00D400000000001

However, I don't always know which of the multiple orgs I can connect to these Ids belong to.

The organization name does appear in the email subject, but in this particular case it is something obscure like

"Developer script execution from Web : "

I've started keeping a spreadsheet to map the Organization Id to the instances, but is there any alternative approach?

After writing this out I might be asking too much. I can't think of much more than the Org Name, Org Id, and possibly server instance that could be used to identify the Salesforce instance. Happy to be proven wrong though.

Attribution to: Daniel Ballinger

Possible Suggestion/Solution #1

Is this for a managed package? If so there are tools available that you can use to keep records of orgIds to customers.

First and foremost is the license management app, which generates a new custom object record and lead for every install of your app. You can use the information from the lead to keep track of what is installed where.

There's also the partner black tab/subscriber support route, which gives you access to customer orgs via the "Grant Login Access" menu, just like SFDC support gets. The admin side of this allows you to lookup customer orgs by orgId.

Attribution to: ca_peterson

Possible Suggestion/Solution #2

Dan One of the problems is when you refresh the box will it not change the instance? How will you update your spreadsheet?

I just found from the link that system.debug('###'+URL.getSalesforceBaseUrl().toExternalForm()); would give you the instance of the org :) (pretty sweeet find ) Thanks to cloudnine \m/

Attribution to: Rao
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content