← All articles
Salesforce · SOQL · Quick Reads

SOQL FIELDS(ALL), FIELDS(STANDARD), and FIELDS(CUSTOM) Explained

SQL developers often try this first:

SELECT * FROM Account

SOQL does not use * to retrieve every field. Salesforce provides the FIELDS() function instead.

Select All Fields

SELECT FIELDS(ALL)
FROM Account
LIMIT 200

FIELDS(ALL) expands to fields available to the running user. It is especially useful for exploration, troubleshooting, and tools where the schema is not known ahead of time.

Select Standard Fields

SELECT FIELDS(STANDARD)
FROM Account

This is useful when you want the object's standard field set without manually listing fields such as Id, Name, CreatedDate, and LastModifiedDate.

Select Custom Fields

SELECT FIELDS(CUSTOM)
FROM Account
LIMIT 200

This selects custom fields accessible on the object. Custom fields normally have the __c suffix.

Mix FIELDS() with Explicit Fields

You can combine a field group with explicit fields when it improves clarity:

SELECT FIELDS(STANDARD), Customer_Tier__c, External_Id__c
FROM Account
WHERE Industry = 'Technology'

Avoid selecting the same field twice.

Why LIMIT Often Appears with FIELDS(ALL)

Salesforce distinguishes bounded and unbounded field groups. FIELDS(STANDARD) is bounded because Salesforce knows the standard field set. FIELDS(ALL) and FIELDS(CUSTOM) can expand differently as an org is customized, so API/query contexts can impose restrictions such as requiring a row limit.

If a query is rejected, do not work around the restriction by blindly retrieving more data. Decide whether you actually need every field.

Production Integration Guidance

For a stable integration contract, an explicit list is often safer:

SELECT Id, Name, Industry, External_Id__c, LastModifiedDate
FROM Account
WHERE LastModifiedDate >= LAST_N_DAYS:1

Explicit fields make the contract visible, reduce payload size, and prevent a newly created custom field from unexpectedly becoming part of a generic extraction.

Use FIELDS() when schema flexibility is the point. Use explicit fields when contract stability is the point.

Security Still Applies

FIELDS() is not a mechanism for bypassing object or field access. Queries execute in the security context applicable to the API/tool/code path you are using.

Quick Reference

-- Standard fields
SELECT FIELDS(STANDARD) FROM Account

-- All fields
SELECT FIELDS(ALL) FROM Account LIMIT 200

-- Custom fields
SELECT FIELDS(CUSTOM) FROM Account LIMIT 200

References

CONTINUE READING

Explore closely related architecture, integration and implementation topics.