Announcing the Salesforce Handbook

Recently, Jeff Douglas and I saw the potential for a beginner’s book – aimed at business owners, analysts and developers, that comprehensively documents Salesforce and Force.com. There is a tonne of documentation out there and we thought “Wouldn’t it be nice to have a handbook that lightly summarised the most important areas of the platforms as well as offering some best practise advice”. We mulled it over for a time, and today we’d like to announce that we’re currently writing: The Salesforce Handbook A newcomer’s guide to building applications on Salesforce.com and the Force.com Platform. Hand-in-hand with the book we’ll be publishing content from the book on a WordPress site. Here you can expect to find excerpts from the book, but also content that supplements the book e.g. areas that’ll serve as best-practice hubs with links to official documentation, blog posts that rock the party, and even superb discussion forum …

Read more

SOSL, friend or foe?

As requested by Chris Peterson I’d like to dig a bit more into SOSL. This is as much a lesson for me as anyone else, and I’d be ecstatic if anyone out there could offer a bit more depth on the topic. SOSL (or sossel) is Salesforce’s search language, and in my experiences definitely has it’s advantages(which are significant in the CRM) and limitations(which may stem from me/us just not knowing how to use it properly). First let’s make sure you have the standard docs memorised.

Basic doc on SOSL within Apex code

API doc, thorough on syntax although might not have some common examples.

Doc for dynamic SOSL

Right, now that we have those committed to memory we can delve into what I think are the advantages and disadvantages of SOSL..

Read more

Handling System.QueryException

When attempting to fetch a single record from the database it is easy to run into the above exception. I’ve seen two schools of thought in dealing with this issue – mostly in the forums – and have been hoping to find a more official standpoint.

Read more

How to avoid Governor Limits [Part 1 of N]

This topic is waaaay too big to cover in one post, so for now I’m going to concentrate on avoiding this particular exception: ‘Too many SOQL queries’. I will also touch on the ‘Too many DML rows’ exception, and expand on it’s solutions in another post. Bulkifying your triggers is another topic I will cover at some later date, but the methodologies mentioned here should go some way towards helping you avoid some of the Governor Limits there too.

Read more

SOQL ‘Distinct’ Keyword

It doesn’t exist. Sad but true.

In SQL there is a clause that ensures a duplicate free result set is returned by any query you issue e.g. You want to retrieve a duplicate free list of first names from the table clients. The column holds the following values: Alice, Bob, Alice. In Oracle SQL you would use the following query (and it would return the names Alice and Bob each listed once).

SELECT DISTINCT firstname
FROM clients;

Unfortunately SOQL doesn’t have this capability although there is an Apex trick that can be employed as a work-around.

Read more