[SalesForce] SOQL not displaying all the fields requested (relation fields)

I am not sure if I am missing something but I am doing the query below and for some reason it is not displaying in the result the relationship fields requested, while when I do it from the developer console it works fine.

My query looks like this:

registrations = [Select Id, Name, miiEventV1__Status__c, miiEventV1__Client__r.Name, miiEventV1__Client__r.PersonMobilePhone, miiEventV1__Client__r.PersonEmail, miiEventV1__Client__r.PersonHomePhone,miiEventV1__Client__r.Email_Subscriptions__c ,miiEventV1__Client__r.Client_Manager__c From miiEventV1__Registration__c LIMIT 1];

My debug log looks like this:

system.debug('@@@@'+registrations);
displays:
DEBUG|manza(miiEventV1__Registration__c:{Name=REG0016109, RecordTypeId=01290000000G2OOAA0, miiEventV1__Client__c=001N000000LnHirIAF, Id=a0AN0000002s1SDMAY, miiEventV1__Status__c=Registered})

In the developer console:
enter image description here

I dont understand what is happening, why the debug log is not getting the fields miiEventV1__Client__r…?

Best Answer

The debug logs will only show the Foreign Key when you debug the sObject like you have.

If you

system.debug(registrations. miiEventV1__Client__r.Name);

You Should See the name being output.

Related Topic