Category Archives: Documentation

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

Apex Method of the Day – Database.Batchable

MyIterableBatch implements Database.Batchable<AnyTypeYouLike> Examples: IntegerIterableBatch.cls CustomTypeIterableBatch.cls Force.com Apex Code Developer’s Guide – Using Batch Apex Original Tweet

Posted in Documentation | Tagged , , | Leave a comment

Apex Method of the Day – List Iterator

Example: Force.com Apex Code Developer’s Guide – List Methods Force.com Apex Code Developer’s Guide – Custom Iterators Original Tweet

Posted in Documentation | Tagged , | Leave a comment

Apex Method of the Day – JSON.deserialize(jsonString, List.class)

List<Foo> f = (List<Foo>) JSON.deserialize(jsonString, List<Foo>.class); Force.com Apex Code Developer’s Guide – JSON Methods Original Tweet

Posted in Documentation | Tagged , , | 1 Comment

Apex Method of the Day – New Map from SObject List

List<SObject> lst; … Map<ID, SObject> mp = new Map<ID, SObject>(lst); Force.com Apex Code Developer’s Guide – Maps from SObject Arrays Original Tweet

Posted in Documentation | Tagged , , | Leave a comment

Apex Method of the Day – addFields

public class MyControllerExtn { public MyControllerExtn(ApexPages.StandardController c) { // include fields not referenced on the Visualforce page c.addFields(new List<String>{‘Foo__c’,’Bar__c’,’Force__c’}); } } Force.com Apex Code Developer’s Guide – StandardController Class Original Tweet

Posted in Documentation | Tagged , , | Leave a comment