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
Manoj ParidaManoj Parida 

Getting Opportunities without Partners

Could someone give an idea to retrieve Opportunities without having a partner in salesforce using SOQL or Apex? I have many duplicate opportunities and want to filter out those without having any partners.

Thx.
Shashikant SharmaShashikant Sharma
You could filter on field "PartnerAccountId" on opportunity

List<Opportunity> listPartnerOpp = [ Select Id from Opportunity Where PartnerAccountId !=: NULL ];

you could query OpportunityPartner to get more information about partner 

https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_opportunitypartner.htm  

let me know if you have any questions.