Contact Us:

670 Lafayette Ave, Brooklyn,
NY 11216

+1 800 966 4564
+1 800 9667 4558

Creating a dynamic SOQL which includes all the fields

I have seen this question several times on developer forums and I thought it could be another addition to Salesforce cookies. If you are wondering how can you query all the fields of an object then you can use the following code snippet.
https://gist.github.com/sfcure/81888ea3d0038b8f14df7c2006d98d7a
The above code snippet using describe calls to get all the fields and then created a dynamic SOQL query to get all the field values.
This is quite similar to SQL query which uses wildcard characters – SELECT * FROM Table.

Leave a comment

Your email address will not be published. Required fields are marked *