Skip to content

Instantly share code, notes, and snippets.

View smaquois123's full-sized avatar

JC Smith smaquois123

  • Superfly Development
  • Columbia, SC
  • 19:12 (UTC -04:00)
  • X @SuperflyDev
View GitHub Profile
@johncasimiro
johncasimiro / Mimic SQL select * statement in SOQL using Apex
Created December 9, 2010 06:57
A code snippet that mimics the popular Select * SQL syntax in force.com's Apex language.
/*
* @description: A code snippet that mimics the popular Select * SQL syntax in force.com's Apex language.
*/
// Initialize setup variables
String objectName = 'Contact'; // modify as needed
String query = 'SELECT';
Map<String, Schema.SObjectField> objectFields = Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap();
// Grab the fields from the describe method and append them to the queryString one by one.