1

I have a batch Apex job where I want to query a bunch of leads.

How can I filter out already closed leads from the SOQL query?

I would think something like

[SELECT ... FROM Lead__c WHERE leadStatus != 'Closed'] 

would work but I don't know the exact way to do this.

4

If by closed, you mean converted, you can use the isConverted field, e.g.

[select id,name from lead where isConverted=false]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.