Instantiating an empty list of SObjects

You’re building a dynamic Apex class so general you’re thinking about promoting it to colonel. You’ve slogged through the Salesforce documentation on the topic, a feat in itself, but are having issues instantiating an empty list of SObjects to be processed in some way. If you attempt to do this in the seemingly Salesforce manner i.e. [code language=”java”] List<SObject> sobjects = new List<SObject>(); [/code] You will receive the following error: Compile error: Only concrete SObject lists can be created This can be rather frustrating as this type of data structure is one of the more commonly used. There are however 3 workarounds, one slightly more elegant than the rest. NB myObject is a SObject. [code language=”java”] List<SObject> sobjects = Database.query(‘select id from ‘ + myObject.getSObjectType() +’ where id=null’); [/code] [code language=”java”] String searchquery=’FIND\’xxx\’IN ALL FIELDS RETURNING ‘+ myObject.getSObjectType() +'(name)’; List<List<SObject> searchList=search.query(searchquery); List<SObject> sobjects = searchlist[0]; [/code] or finally you could …

Read more

Salesforce Managed Packages

This is one area of the Salesforce.com platform that I’m no fan of.

In short, you code a complex application and it’s beautiful. You marvel at the wonder of the sleek UI, the intelligent complexity of the code, and the comprehensive unit testing you’ve implemented. Now you wish to package your application up, advertise it briefly and have the customers pour in. Not so fast my friend.

Packaging can be a nightmare, and there are certain hurdles to this step that you won’t find officially documented.

Read more

An Introduction

Salesforce.com is an ever increasing presence on the interweb. They’re leaders in a market that promises to be the next generation of software development, that of cloud computing. Google, Amazon and Mosso are some other names that have realised the current and potential power of developing and/or hosting in the cloud and it’s an area that I’m glad to be involved in from so early on.

Although this tech is not new, it is still young, and I’ve started this blog as a way to contribute to the growing community of Cloud Computing developers. The teething problems are still quite apparent in this industry, and as someone who’s been heavily involved in the technology for some time, I’m starting to see how problematic certain aspects of this type dev are(although the benefits far outweigh the drawbacks).

Read more