function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Not able to access data by child to parent relation query in platform site.

Hi all,

I am getting an error on site


Select Status__c, OwnerId, Id,User__c, User__r.Username__c, Group__r.Name__c, Group__c From GroupMember__c where Group__c = : groupid and Status__c = 'Pending'

i am  running above querry n i am getting error mentioned below:

System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: GroupMember__c.User__r.


I have tried many combinations with the querry.

if any one have its solution please help me out from the situation.


thanks in advance,



Amit, check in the schema browser for the correct relationship syntax (from Eclipse, open salesforce.schema and expand your object). I notice you're trying to SOQL on GroupMember__c, but GroupMember (and a lot of those fields) are standard objects/fields - presumably you've created all those fields yourself? ie they are all custom fields? Only custom objects/fields will use __r for relationships, standard objects will have different syntax, again accessible via the schema browser.




I know that __r is used with custom objects relation. I have created custom objects within my site.

I have created custom objects by the same name user__c, groupmember__c, group__c etc.