Summer 11 Pre-release and the System.URL class

Summer11 One of the trends I have noticed in the past few releases is an even greater emphasis on openness on the platform. Spring 11 dramatically reduced governor limits and increased the size of some message payloads to make it easier to perform many connectivity use cases. Summer 11 is no different with just in time user provisioning, a new Chatter API (stay tuned for more on this front – I'm working on a cool sample app now), and more. 

If you haven't noticed, Summer 11 pre-release is now available. I always think it is a good idea to sign up early and read the release notes prior to the pre-release webinar scheduled for May 10th. There is only so much you can do in a 45 minute webinar. A little 'playing' beforehand always helps you get the most out of the discussions and samples presented. Besides, if you can jump straight into your Summer 11 org directly after the webinar, you can put some of your newly learned skills to the test.

Once you have signed up for your Summer 11 pre-release org, you can download the release notes and start getting familiar with the new features. I typically save the release notes on my desktop for the first month or so and refer to them often. In addition, I always follow my four step readiness program I shared when Spring 11 was announced. 

But sometimes it is good to start with the basics – the URL. 

We often forget that the trusty URL is key to so many things these days, without it where would REST be for example? Ah, URL, we have had some great times over the years. You never fail to PUT a smile on my face and GET me to smile (sorry for sad, HTTP humor there…..I couldn't resist).

Summer 11 introduces the System.URL class to allow you to create links to objects in your organization. This class is super helpful when you want to link to a document in content, maybe a link to something from within an external email, or within a Chatter post via a trigger for example. 

Here is a quick example taken from the release notes, (and enhanced to ensure correct operation if no data exists) which creates an external-friendly link to an account record:

List<Account> acct = [SELECT name FROM account WHERE name = 'Acme' LIMIT 1];
if(!acct.isEmpty()) {
String fullRecordURL = URL.getSalesforceBaseUrl().toExternalForm() + '/' + acct.get(0).id;

I know this is a super simple example but there are so many places where this would be amazingly helpful. I can already think of a dozen I can use on the road to Dreamforce as we prepare our sessions and work with the speakers etc. 

So here's to the URL, and Summer 11!


tagged , , , , , , , , , , Bookmark the permalink. Trackbacks are closed, but you can post a comment.
  • The link to release notes is broken.

  • You need to be logged into the summer 11 pre-release org for it to work

  • URL class looks simple, but it will save people from doing a lot of hacks to know the node and generate correct base url 🙂

  • URL class will be very helpful when we need to package our component in manage release where we need to append namespace in URL. This will automatically append namespace in our URL.
    Indeed a very useful feature.

  • This is pretty awesome! Finally we can now use this in Batch Apex, Triggers, ETC! This was one of first things we immediately put into our orgs now that Summer 11 has been released!
    -Cory Cowgill
    Twitter: @corycowgill