Skip to content

Instantly share code, notes, and snippets.

View chrispaquet's full-sized avatar

Christopher Paquet chrispaquet

View GitHub Profile
@chrispaquet
chrispaquet / Mimic SQL select * statement in SOQL using Apex
Created January 15, 2018 03:39 — forked from johncasimiro/Mimic SQL select * statement in SOQL using Apex
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.