Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here


A collection of useful helper classes for Salesforce and Force.com.

Subscribe to updates I use Force.com-Helper-Classes

Statistics on Force.com-Helper-Classes

Number of watchers on Github 59
Number of open issues 0
Main language Apex
Average time to merge a PR about 17 hours
Open pull requests 0+
Closed pull requests 0+
Last commit almost 7 years ago
Repo Created almost 9 years ago
Repo Last Updated over 2 years ago
Size 131 KB
Organization / Authorkevinohara80
Page Updated
Do you use Force.com-Helper-Classes? Leave a review!
View Force.com-Helper-Classes activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating Force.com-Helper-Classes for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Helper Classes for Force.com

I am building a collection of useful helper classes for Salesforce and Force.com.


You should contribute...

  1. Fork this repo

  2. Add some awesomeness (either classes of your own or enhancements to existing classes)

  3. Submit pull request

  4. Enjoy

Helper Classes


The Async class aims to circumvent a limitation of asynchronous (@future) methods in Salesforce. The current @future implementation will only allow for primitives or collections of primitives to be passed into an @future method. The Async class uses native JSON serialization/deserialization to allow for passing an SObject, or List into an asynchronous method for DML operations. A helper method is also included for making the serialization processes simpler.


List<Lead> leads = [SELECT Id, FirstName, LastName FROM Lead LIMIT 10];

for(Lead l : leads) {
  l.FirstName = 'Somethingelse';

// this will update asynchronously


I find myself needing to run mass-updates on records once I finish an On Update trigger. I created this simple utility batch class that runs an update on all records retrieved by a SOQL query string that is supplied as the classes only argument. There is a static method that will run this in one line.


String batchId = InvokeUpdateTriggerBatch.invoke('SELECT Id FROM Lead');


I created this class to automatically format US State names and State Codes from raw user input. The result is better reporting and cleaner data. The class has a single static method called getState() that accepts a String as its argument. It returns a State object with the formal State Name and State Code as its properties. See the test method for usage examples.


String myState = 'mich';

// This will return MI
myState = StateFormatter.getState(myState).statecode;

// This will return Michigan
myState = StateFormatter.getState(myState).statename;


I created this class to help circumvent the 1000 element maximum in Map collections. It's not a wonderful solution, but until parameterization is allowed in Apex, this is a decent workaround.


SuperMap mySuperMap = new SuperMap();

for(Integer i=1; i<=10000; i++) {
  mySuperMap.put(String.valueOf(i), 'value' + String.valueOf(i));

// remember to cast as the supermap stores generic objects
String val = (String) mySuperMap.get('10000');


SearchHelper is a convenience utility that makes constructing SOSL queries easier and less prone to errors. It supports searching multiple SObjects and includes support for adding Fields, Where clauses, and Limits. Search results are easily accessed by object.


SearchHelper sosl = new SearchHelper();
sosl.setSearchScope( SearchHelper.Scope.ALL_FIELDS );
sosl.setSearchObjects( new List<String>{ 'Account', 'Contact' } );

// set Account options
sosl.setFieldsForObject( 'Account', new List<String>{ 'Name', 'BillingCity', 'Phone' } );
sosl.setConditionForObject( 'Account', 'CreatedDate <= TODAY' );
sosl.setLimitForObject( 'Account', 25 );

if( sosl.find( 'Acme' ) ) {  // returns false if there is an error
   List<Account> accounts = (List<Account>)sosl.getResultsForObject( 'Account' );
   List<Contact> contacts = (List<Contact>)sosl.getResultsForObject( 'Contact' );
} else {
   System.debug( 'SOSL Error: ' + sosl.getError() );


  • Kevin O'Hara
  • Clint Lee
Force.com-Helper-Classes list of languages used
Other projects in Apex