+ Start a Discussion
MrTheTylerMrTheTyler 

How to determine if a case status picklist value Indicates that the case is closed?

Using Schema.DescribeFieldResult and getPicklistValues() one can get the labels, values, isenabled, and isdefault info on each entry in a picklist.   I am trying to figure out how to know if a picklist value for the status of a case indicates that the case is closed.  

 

 

Cheers,

 

 

Tyler

Best Answer chosen by Admin (Salesforce Developers) 
MrTheTylerMrTheTyler

Identifying Closed/Open Cases Statuses via Metadata

 

Stumbled across the answer in this past post.   Answer is simple - there is a table named CaseStatus which case status references.  In this table there is a boolean field called isClosed.  

All Answers

Ispita_NavatarIspita_Navatar

So your requirement is to know if the status of a case has the value "Closed", will it not be pretty straight-forward that you just check the value of the status fields of case record and if it is closed it will have the value "close".

 

Or am I missing some details?

Besides I think describeschema is more about finding the structure of schema or database structure.

Do let me know in case I am missing any detail.

 

 

MrTheTylerMrTheTyler

 

Let me give some more background.  I am building a visualforce page with custom controller for a new version of the "close case" screen which is arrived at after clicking the "Close" button on the standard case screen.  My client has several status values which they have created by modifying the picklist values of the "Status" field of the case object.  If we go to setup>customize>case>fields then click on the "Status" link under the column heading "Fields Label", we see all the values that have been created for the status picklist.  Each one of those values has 2 checkboxes next to it.  "Default" and "Closed".  Using the schema methods one can determine if the picklist value is a default value, however,  I do not see in the docs how to determine if a picklist entry indicates that the case is closed.

 

My reason for this is that the close case screen should only show entries in the status picklist that indicate that the case is closed - which is how the standard close case screen behaves currently.

 

----------------------------------------------------------------------------------------------------

Excerpt from Describe Field Result Methods in Apex Docs

---------------------------------------------------------------------------------------------------

The following table describes the methods available as part of the PicklistEntry object. None of the methods take an argument.

Name Data Type Description

getLabelStringReturns the display name of this item in the picklist
getValueStringReturns the value of this item in the picklist
isActiveBooleanReturns true if this item must be displayed in the drop-down list for the picklist field in the user interface, false otherwise
isDefaultValueBooleanReturns true if this item is the default value for the picklist, falseotherwise. Only one item in a picklist can be designated as the default
MrTheTylerMrTheTyler

Identifying Closed/Open Cases Statuses via Metadata

 

Stumbled across the answer in this past post.   Answer is simple - there is a table named CaseStatus which case status references.  In this table there is a boolean field called isClosed.  

This was selected as the best answer