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
Frances AllenFrances Allen 

Conditional Filtering with Apex and SOQL

I want to filter records in Salesforce depending upon what custom picklist option is selected for our custom field Application_status__c.

AFTER this filter takes place, I want to iterate through a Contacts list that meets a specific criteria and print them out to a list. My issue is:

1. SOQL does not allow querying of custom picklist values. 
2.  Application__c on which Application_status__c (my picklist) is located, cannot be accessed from standard Contact object. So my code would check out this data and use Contact SOQL. For a newbie this is kind of arcane knowledge.

I know I need the .getDescribe() method.

I need to only select the individuals who meet the Contacts list criteria after checking application picklist status, but I cannot figure out how to get SOQL and my idea to work together. Will this need to be re-written or can I plug in a method within the SOQL?
User-added image

This is ideally the pseudo code that I would want to filter through the above list:

User-added image

Thank You.