I've seen this question on the Salesforce.com message boards but have never seen an answer so I thought I would post it here. Here's my dilemma... we are writing some customization that requires us to construct the URL to a Salesforce.com record (e.g. https://na5.salesforce.com/02u300000000ACi) and send it via email. I've seen a solution to this using Visualforce but never in Apex.
Here is what I came up with but it seems that there must be a better way. The only constant that I could come up with is our Production org ID. So my Apex class holds a reference to this ID and then I have a method that checks the current user's org ID and constructs the URL.