Can I query formula fields in SOQL

formula-fieldsoql

I have a custom object with a custom formula field. When I try to query that field, I get an error.

enter image description here

% sfdx force:data:soql:query --query "SELECT FullNamePrimary__c FROM LoanBorrower__c"
Querying Data... done
ERROR running force:data:soql:query:  
SELECT FullNamePrimary__c FROM LoanBorrower__c
       ^
ERROR at Row:1:Column:8
No such column 'FullNamePrimary__c' on entity 'LoanBorrower__c'...

Are formula fields not available from SOQL? Is this documented somewhere (yes, I did check the formula field documentation on the limits, there was no mention of this limitation).

Best Answer

Formula fields are most certainly available in SOQL.

Your authenticated user almost certainly does not have Field-Level Security (FLS) access to this field. When you access Salesforce via the API, FLS is enforced against your user, which typically produces this exact error.