Skip to content

Instantly share code, notes, and snippets.

@barelyknown
Created December 26, 2011 20:44
Show Gist options
  • Save barelyknown/1522089 to your computer and use it in GitHub Desktop.
Save barelyknown/1522089 to your computer and use it in GitHub Desktop.
Textmate Snippet for Sobject Maps by Id
Map<Id, ${1/./\u$0/:enumerate}__c> $1Map = new Map<Id, ${1/./\u$0/}__c>();
for (${1/./\u$0/}__c $1: $1s) {
$1Map.put($1.id, $1);
}
@barelyknown
Copy link
Author

Since there isn't a way to dynamically create a Map of SObjects by ID if you're using Database.query() instead of straight SOQL, I wrote this snippet for Textmate that generates that code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment