public class TempDeleteController{
public List<Contact> childContact{get; set;}
private final Custom_Object__c co;
public TempDeleteController( ApexPages.StandardController stdController ){
this.co = (Custom_Object__c)stdController.getRecord();
childContact = new List<Contact>();
for( Contact c: [SELECT Id,Name FROM Contact WHERE Custom_Object__c = :co.Id ] ){
childContact.add(c);
}
}
}
hi alex problem solved , actually i was trying to make standard contact object as child of custom object but when i take custom object child different custom object then its work fine for me. thanks for your help
yes, i just wanted to confirm with you can we make a standard object such as contact as a child of custom object, and then can get the standard object object as child in query if yes. then problem still there because i used custom object now, and its become parent and child both custom object now, but when parent is custom and child is standard then i cant fetch the query from the soql. why?
public class TempDeleteController{
public List<Contact> childContact{get; set;}
private final Custom_Object__c co;
public TempDeleteController( ApexPages.StandardController stdController ){
this.co = (Custom_Object__c)stdController.getRecord();
childContact = new List<Contact>();
for( Contact c: [SELECT Id,Name FROM Contact WHERE Custom_Object__c = :co.Id ] ){
childContact.add(c);
}
}
}
Page Apex class
All Answers
Try
Thanks,
Alex
Hi Aatish,
Please check the child relationship name in Contact object. (Open Lookup/Master-Detail field-There you can see Child Relationship value)
I checked with Account and Contact relationship. It is working for me.
Field is
Check the Child Relationship Name and use that
Page Apex class