[SalesForce] SOQL – How to query for opps which are not lost ( but not using stagename)

I am looking to query for all open and won opps, but i dont want to use the stagename as there multiple closed-Lost stages and there could couple more added later. I dont want to change the query everytime there is a new stage added in.

WHERE stagename not IN('Closed-Lost','Closed-Lost-NoBudget')

is there a way to get the records without explicitly specifying stagename?

Best Answer

If you have the stage properly linked to the Won-Lost, maybe by...

SELECT ID FROM Opportunity WHERE IsWon = true OR IsClosed = false
Related Topic