I’ve marked multiple Case Status picklist values as “Closed”, and now I want to access only those picklist values which are marked as Closed in Apex class. I tried looking for this in documentation but could not find any thing.
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
You need to query a standard salesforce object CaseStatus:
This object represents a value in the case status picklist. Query the
CaseStatus object to retrieve the set of values in the case status
Select Id, MasterLabel From CaseStatus Where IsClosed = true
You nees to use this field “Status” in your SOQL query:
List<Case> cases = [select Id from case where status='Closed']; System.debug('#### cases: ' + cases);
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0