public List<objB__c> recrds{get;set;} public objA__c ob{get;set;}
public DeatilsForObjC(ApexPages.StandardController controller) { ob = new objA__c(); ob=(objA__c)controller.getRecord(); system.debug('__________________________'+ob.id); recrds=new List<objB__c>(); recrds=[select objC__r.Name,objC__r.id from objB__c where objA__c=:ob.id]; system.debug('_________________________recrds_________'+recrds);
}
}
After creating this page, add this VF page in the page layout of object A.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Customer Group (ObjectA) -> Account (ObjectB) -> Contact (ObjectC)
public class DetailsForContacts {
public List<Account> recrds{get;set;} public Customer_Group__c ob{get;set;}
public DeatilsForContact(ApexPages.StandardController controller) { ob = new Customer_Group__c(); ob=(Customer_Group__c)controller.getRecord(); system.debug('__________________________'+ob.id); recrds=new List<Account>(); recrds=[select Contact__r.Name,Contact__r.id from Account where Customer_Group__c=:ob.id]; system.debug('_________________________recrds_________'+recrds);
}
}
on save i get the following error:
Error: Compile Error: Didn't understand relationship 'Contact__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 12 column 8
Hi,
Try the below code snippet as reference
====VF Page======
<apex:page standardController="objA__c" extensions="DeatilsForObjC" >
<apex:pageBlock >
<apex:pageBlockTable value="{!recrds}" var="u">
<apex:column headerValue="ObjectC Name" value="{!u.objC__r.Name}"/>
<apex:column headerValue="ObjectC ID" value="{!u.objC__r.id}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
========Apex Controller========
public class DeatilsForObjC {
public List<objB__c> recrds{get;set;}
public objA__c ob{get;set;}
public DeatilsForObjC(ApexPages.StandardController controller)
{
ob = new objA__c();
ob=(objA__c)controller.getRecord();
system.debug('__________________________'+ob.id);
recrds=new List<objB__c>();
recrds=[select objC__r.Name,objC__r.id from objB__c where objA__c=:ob.id];
system.debug('_________________________recrds_________'+recrds);
}
}
After creating this page, add this VF page in the page layout of object A.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
I modified your example as follows:
Customer Group (ObjectA) -> Account (ObjectB) -> Contact (ObjectC)
public class DetailsForContacts {
public List<Account> recrds{get;set;}
public Customer_Group__c ob{get;set;}
public DeatilsForContact(ApexPages.StandardController controller)
{
ob = new Customer_Group__c();
ob=(Customer_Group__c)controller.getRecord();
system.debug('__________________________'+ob.id);
recrds=new List<Account>();
recrds=[select Contact__r.Name,Contact__r.id from Account where Customer_Group__c=:ob.id];
system.debug('_________________________recrds_________'+recrds);
}
}
on save i get the following error:
Error: Compile Error: Didn't understand relationship 'Contact__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 12 column 8