1

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).

1 Answer 1

3

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.

2
  • This typically happens when you create a field in one org, and then deploy it to another org. The field will be deployed, but the FLS is a separate thing. Deploying profiles has always been a pain. The two main options here are to 1) Create the field from scratch in your target org 2) Use a PermissionSet to include the permission to read and/or write your field (and then assign it to people in your target org).
    – Derek F
    Aug 28, 2021 at 19:17
  • ty, for some reason out of dozens of fields in that table the only ones not available were the formula fields, so I assumed that was the reason.
    – Chuck
    Aug 28, 2021 at 23:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .