Author Archives: Stephen

Back from the Dream side of the Force

Just back from Dreamforce ’13, which was, what’s Marc’s word for it?… oh, yes… awesome. As per my last post, I had two sessions in the DevZone this year: Practical Introduction to Chatter Publisher Actions (with Carolina Ruiz @CarolEnLaNube), and Tests and Testability: … Continue reading

Posted in News | Tagged | 6 Comments

A journey to the Dream side of the Force

I will very shortly be off to San Francisco to attend Dreamforce 2013. I am delighted to be speaking at two DevZone sessions this year: Practical Introduction to Chatter Publisher Actions This session is on Tuesday, November 19th at 1:30 … Continue reading

Posted in News | Tagged | 1 Comment

Apex Method of the Day – String.isEmpty(String myString)

Rather than: Force.com Apex Code Developer’s Guide – String Methods

Posted in Documentation | Tagged , | 1 Comment

Speedy Force.com Documentation Search in Chrome

Google Chrome has a great feature for customising your searches from the “omnibox” (URL/search box) which you can use to speed up your searches of the Force.com developer documentation.

Posted in Tutorials | Tagged , | 2 Comments

The Secret Life of an SObject: Equality, Sets and Maps

Equality When testing for equality between sObjects in Apex, it is the sObjects’ properties – the values of the sObjects’ fields – which are compared. So two separate sObject instances that have the same field values are considered equal: But, if … Continue reading

Posted in Documentation | Tagged , , | 6 Comments

Apex Method of the Day – String myString.split(String regExp)

We can split a String into parts using a token, which in this case is a space: However, the following example, using “.” as a token will fail: System.AssertException: Assertion Failed: Expected: 3, Actual: 0 This is because the token … Continue reading

Posted in Documentation | Tagged , | 1 Comment

Apex Method of the Day – String myString.repeat(numTimes)

public class TestUtility { static Integer s_num = 1; public static String getFakeId(Schema.SObjectType sot) { String result = String.valueOf(s_num++); return sot.getDescribe().getKeyPrefix() + ‘0’.repeat(12-result.length()) + result; } } Force.com Apex Code Developer’s Guide – String Methods

Posted in Documentation | Tagged , | 1 Comment

Apex Method of the Day – Method (and other) Declarations in Anonymous Blocks

An anonymous block is Apex code that does not get stored in the metadata, but that can be compiled and executed using… Developer Console, Force.com IDE [or] The executeAnonymousSOAP API call A method can be defined and called within an Anonymous Block: Decimal d1 … Continue reading

Posted in Documentation | Tagged , | 2 Comments

The Secret Life of an SObject: Defaults

Default values, dirty field tracking, checkboxes / booleans, and the Winter’13 loadDefaults argument… When creating custom objects, we can define default values for our fields which are automatically applied when inserting records. Defaulted when? Say we have a custom Sales … Continue reading

Posted in Documentation | Tagged , , , | Leave a comment

LockingRules

Recently I was working on a prototype Force.com application for which I anticipated heavy use of Salesforce Approvals Processes. When testing my prototype, I found the record locking system with Approvals fell short of what I wanted – I needed … Continue reading

Posted in Utilities | Tagged , , , , , | 1 Comment