I want to query open opportunities, but do not know the api name of the field. In the Opportunities report one can set Opportunity status in the top middle to be Closed, Closed Won, Open, or Any. StageName does not have the Open value. So the query "SELECT AccountId, MRR__c, from Opportunity where StageName='Open' returns nothing. Help appreaciated.

enter image description here


3 Answers 3


Stagename does not have an value = "open" The standard values are

Needs Analysis
Value Proposition
Decision Makers Perception Analysis
Proposal/Price Quote Negotiation/Review Closed Won
Closed Lost

If you are referring to the status you need to do

SELECT Id, Name FROM Opportunity WHERE IsClosed = FALSE 

The above query gives you all open opptys.

Refer here : How can i query for the type in opportunity stage?

This doc provides more info on OpportunityStage



Best way to check field names that you dont know is to go to the record page, and click on the view for the field. Your click order should be: setup>customize>opportunities>fields>status. On that page, you will see the Field Name, Field Label, and the API Name. You can use this to determine what name to use when interacting with the data. For example, my status fields API name is Status_Del__c. The __c is important, its what tells salesforce this is a custom object. This will be placed in a query as so:

[SELECT AccountId, MRR__c FROM Opportunity WHERE Status_del__c='Open']

You also have a extra , in the query- you'll want to remove that. Make sure you're querying the right fields, as well.


You can query on Opportunity Object referring to all of the Fields that you expect to see in reporting. Later, you can then apply aggregates (called bucketing in a standard report) to what's needed for the calculations in your report.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .