Skip to content

Instantly share code, notes, and snippets.

View agentgill's full-sized avatar

Mike Gill agentgill

View GitHub Profile
@agentgill
agentgill / README.md
Created March 29, 2018 18:00 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@agentgill
agentgill / AutocompleteController.cls
Created March 14, 2018 19:34 — forked from peterknolle/AutocompleteController.cls
Lightning Autocomplete Component
public class AutocompleteController {
@AuraEnabled
public static List<sObject> getSuggestions(String sObjectType, String term, String fieldsToGet, Integer limitSize) {
// could add in logic to remove possible duplicate fields
String fields = fieldsToGet.length() > 0 ? ',' + fieldsToGet : '';
String soql =
' SELECT Name, Id ' + String.escapeSingleQuotes(fields) +
' FROM ' + String.escapeSingleQuotes(sObjectType) +
' WHERE Name Like \'' + String.escapeSingleQuotes(term) + '%\'' +