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.
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.
I am certified Salesforce Developer with Sales and Service cloud certifications. I am a true believer in #GivingBack principle and a Salesforce enthusiast. I am working as a member of our #SalesforceOhana to learn and help other fellow Trailblazers of the community to grow and learn.
“I’m a true believer in karma. You get what you give, whether it’s bad or good.”