I have a custom object (Registration__c) that has a lookup field (Approver__c) to the standard User object.
I'm trying to construct an SOQL query that will return the user's ID.
My assumption is that since it's a child to parent relationship, the query should be:
SELECT Id, Approver__r.Id
FROM Registration__c
However, running the above query results in "No such relation 'Approver__r' on entity 'Registration__c'."
What am I missing?
Update
Query using 'Approver__c' returns "No such column 'Approver__c' on entity 'Registration__c'."
SELECT Id, Approver__c
FROM Registration__c
Here's a couple of screenshots showing the custom object (Registration__c) and custom field (Approver__c):
Reference
Best Answer
If the field exists, and it is spelled properly, it is likely a permissions problem with the user running the query.
Also, if you wish to just get the
Id
of the related record, you can just doApprover__c
instead ofApprover__r.Id
for simplicity.