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
sfdclivesfdclive 

data loader

Hi,

 

I want to export my custom_object__c by using data loader and it is related with opportunity.

 

if i am exporting the cutom_object__c i need to export the opportunity record which is related to that custom_object__c 

 

please tell me the sutable query

 

thanks

sri

 

Best Answer chosen by Admin (Salesforce Developers) 
Satish_SFDCSatish_SFDC

Hi Sri,
Assuming that Opportunity is the Parent to the Custom Object and Opportunity__c is the API Name of the Opportunity Lookup field on Custom_Object__c , the following query can get data from both the objects.

 

Select ID, Name ,Opportunity__r.ID, Opportunity__r.Name From Custom_Object__c

 

You can add the other fields as well.

 

Regards,
Satish Kumar

 

 

 

 

All Answers

Satish_SFDCSatish_SFDC

Hi Sri,
Assuming that Opportunity is the Parent to the Custom Object and Opportunity__c is the API Name of the Opportunity Lookup field on Custom_Object__c , the following query can get data from both the objects.

 

Select ID, Name ,Opportunity__r.ID, Opportunity__r.Name From Custom_Object__c

 

You can add the other fields as well.

 

Regards,
Satish Kumar

 

 

 

 

This was selected as the best answer
AroraAnupAroraAnup

Another quick way to do this is by using a report. Assuming that Opportunity is the Parent and your Custom object is the Child, when you try to create a new report, you can select the report data type as "Opportunities with Custom Object"

This way you can fetch fields from both the objects into one report and can then ave only those opportunities that have a record in this related custom object and vice versa.

Once you get your report, you can then do an export to get a CSV/Excel output.

 

Hope this helps!