0

In APEX class we have SOQL: Case carrierList= [SELECT Id, CaseNumber, Current_Quoted_By_Carrier__c, Current_Quoted_By_Carrier__r.Name, Quoted_By_Carrier__c, Quoted_By_Carrier__r.Name FROM Case WHERE Id = :con.Id];

When we run SOQL in Workbench or Developer Console for specific recordId the Name is populated, but in APEX SOQL returns record Id, but no Name (DEBUG|Quoted by Carrier Name = null).

Case.Quoted_By_Carrier__c is a lookup on Account.

Val
  • 1
  • 1
    Does this answer your question? [How to query a lookup on a lookup in salesforce SOQL](https://stackoverflow.com/questions/71580497/how-to-query-a-lookup-on-a-lookup-in-salesforce-soql) – eyescream Jun 22 '22 at 23:19

1 Answers1

0

Check to make sure the profile has access to the account record and that the profile has read permissions on the account name field.

Psymn
  • 372
  • 2
  • 13
  • Generally good advice but here... query's not "WITH SECURITY_ENFORCED" and we're talking about `Account.Name`, don't think you can break your system so hard it becomes invisible. – eyescream Jun 23 '22 at 05:57
  • No, it has nothing to do with security. The same user as Administrator and as I mentioned SOQL does work via tolls but not in APEX CLASS. – Val Jun 24 '22 at 00:49