How can we retrieve “Case Status” picklist values marked as “Closed” in setup?

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.

I need to find "picklist" values which are marked here as Closed

Answers:

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.

Method 1

Update:

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
picklist.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x