SOQL FIELDS() Function
With Salesforce Spring 21 release, Salesforce has introduced SOQL Fields functions. The FIELDS() function lets us select groups of fields without knowing their names in advance. This function simplifies SELECT statements, avoids the need for multiple API calls, and provides a low-code method to explore the data in the org. This function is available in API version 51.0 and later.
we can use FIELDS() as per below
- FIELDS(ALL)—to select all the fields of an object.
- FIELDS(CUSTOM)—to select all the custom fields of an object.
- FIELDS(STANDARD)—to select all the standard fields of an object.
For example we can use below query to get all data
SELECT FIELDS(ALL) FROM Account LIMIT 200
But we have some limitations here.
- If we try to use FIELDS(ALL) or FIELDS(CUSTOM) in Spring 21 we will get the error “The SOQL FIELDS function is not supported with an unbounded set of fields in this API”.
- LIMIT n—where n is less than or equal to 200.