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
OpenbravoOpenbravo 

referencing picklist in Apex select

Hi,

I have the following picklist (it's basically the Stage field of an Opportunity):

Product Evaluation (25%)  
Prospect (Quote) (50%)
Negotiating (60%)
Well Positioned (75%)
Closed Won (100%)
Canceled (0%)
Closed Lost (0%)

I want to filter out  Well Positioned once in an Apex statement, for example:

AggregateResult[] arId = ([select Partner__c, sum(OBPS__c) amt, sum(OBPE_Weighted__c) wamt, sum(Probability) wct, count(amount) ct from Opportunity where amount <> null and Partner__c <> null and and OBPS__c > 0 group by Partner__c]);

How can I filter by picklist values?
nickwick76nickwick76
Hi, 
Just filter by the value. For an opportunity it would look like this for example:

SELECT Name,StageName FROM Opportunity where StageName = 'Identified'

Br / Niklas