Site icon Salesforce Binge

Get All Fields In SOQL At One Go! – Spring ’21

It’s been a pain to query all the fields in the SOQL query, especially when someone has been trying to execute it in a Developer Console.

Workbench and VS code does make life a tad bit easier but hey! all of this just got a lot simpler.

If you have worked with SQL Database and used SELECT * FROM table_name, I am certain that you would badly be wanting to have leveraged that simplicity in SOQL.

Salesforce has made that possible with Spring ’21 release by using FIELDS(ALL)FIELDS(STANDARD), or FIELDS(CUSTOM) in your SELECT statements.

List<Account> accountsList = [SELECT FIELDS(ALL) FROM Account LIMIT 200];

Pros:
We can avoid using Describe calls in most use cases.
Save some time juggling between our IDEs, Workbench, or memorizing API names.

Cons:

Fetching more than 200 records per query is not allowed.

Exit mobile version