+ Start a Discussion
uniuni 

how to retrive single record from a 1st custom object having relatedlist from 2nd custom object

can u give me an idea that how to retrive single record from a 1st custom object having relatedlist from 2nd custom object

2nd custom object is having master relation ship with 1st...............


thanq

Rajesh SriramuluRajesh Sriramulu

Hi,

 

if u retrive the record from child query to get parent record means just write ordinary query.

 

if u r retrieve the record from paernt query to get child record means inner query needed.

 

 

Regards,

Rajesh.

souvik9086souvik9086

public List<FirstObj__c> firstObjList = new List<FirstObj__c>();
public FirstObj__c firstObjSingleRecord = new FirstObj__c():
firstObjList = [select id,name,LookupField__c from FirstObj where LookupField__c = SecondObj.id];
if(firstObjList.size()>0){
firstObjSingleRecord = firstObjList.get(0);
}

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

uniuni

not working yar

 

souvik9086souvik9086

Please mention what is the error coming.