Showing posts with label SOQL. Show all posts
Showing posts with label SOQL. Show all posts

Apr 6, 2021

ReUsable Apex Snippets

Query All Fields from Specific Object

public static String AllFields(String ObjectName) {

List<String> fields = new List<String>(

 Schema.getGlobalDescribe().get(ObjectName).getDescribe().fields.getMap().keySet()

);

String query  = 'SELECT '+String.join(fields, ',')+' FROM '+ObjectName;


return query;

    }