I have Three Objects A, B and C. C is junction Object
Through the Object of C , I want to access the fields of A and B.
I am doing it as
Am I doing something wrong here?
You should read through this Relationship Queries documentation that amongst other things explains the use of
If you have these custom objects:
A__c B__c C__c
the field reference would be:
C__c c = ...; Object aField = c.A__r.Field__c;
Note that for standard objects e.g. Contact the reference fields don't follow this pattern but rather are usually just the same as the referenced object type (with the ID of the referenced object usually having an ID suffix).