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
koti91koti91 

Help for a SOQL Query

I had two objects . Lead__c and Oppurtunity__c.

 

Oppurtunity__c has a look up to Lead__c . Lead__c has many oppurtunities related to it.

 

I need to find if Lead__c has one oppurtuntiy or more. 

 can any one help

 


Navatar_DbSupNavatar_DbSup

Hi,

Try the below code snippet as reference:

 

lead__c []leadobj=[select id,(select id from Oppurtunity__c) from lead__c]; //use Plural name of Oppurtunity__c object

for(lead__c ll:leadobj)

{

                if(ll.Oppurtunity__c.size()>0)

                {

                                //your logic

                }

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.