4

The Case Status field has several closed values e.g. Closed. Order Complete, Closed. Order Cancelled etc

We also have several "Support Processes" defined which select various Case "Status" by Record Type.

I have set up the following: Setup | Customize | Case | Case Support settings - Show Closed Statuses in Case Status Field = false. The Case "Status" field now no longer displays the closed values in the "Status" field. The standard Closed Case page only displays the Closed vlaues.

We decided to override the Closed Case button to now show a VF page so we can incoporate other functionality. The status field now shows all Case Status values which appear in the Case support Process for the particual Record Type. I really only want the "Closed" values to appear in the Status dropdown!

<apex:pageBlockSectionItem >
    <apex:outputLabel >Status</apex:outputLabel>                    
    <apex:inputField value="{!case.status}" required="true"/>
</apex:pageBlockSectionItem>

I cant seem to find a solution for this, Is this at all possible?

  • did u refer this question already : salesforce.stackexchange.com/questions/24621/… – Vamsi Krishna Gosu Oct 22 '15 at 9:45
  • Yes I did notice the post. Any idea how I combine the SOQL query against the Case RecordType to only bring back the "Closed" values for a particular RT ? – Ian Oct 22 '15 at 9:53
  • Unfortunately it does not look like CaseStatus has any information about RecordType at all. You might have to dig into the Metadata API for that. – Adrian Larson Oct 22 '15 at 15:25
  • Maybe this will help. – Adrian Larson Oct 22 '15 at 15:30
0

You can use Javascript to remove pick list values.

    <apex:page standardController="Case">
<apex:pageBlock id="thePageblock" >
<apex:pageBlockSection id="thePageblockSec" >   
<apex:pageBlockSectionItem id="pageBlocksec">
    <apex:outputLabel id="outputLab">Status</apex:outputLabel>
     <apex:form id="frm">                    
    <apex:inputField id="picklistValues" value="{!case.status}" required="true"/>
     </apex:form>

</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>

   <script>

window.onload = function myFunction() {

var selectobject=document.getElementById('{!$Component.thePageblock.thePageblockSec.pageBlocksec.frm:picklistValues}');
  for (var i=0; i<selectobject.length; i++){

  if (selectobject.options[i].value == 'New' ){

     selectobject.remove(i);

     }

    if (selectobject.options[i].value == 'Working' ){

     selectobject.remove(i);

     }

     if (selectobject.options[i].value == 'Escalated' ){

     selectobject.remove(i);

     }

  }


}

</script>



</apex:page>
| improve this answer | |
  • 2
    This is very brittle. It does not scale. It requires extensive cross-browser testing. – Adrian Larson Oct 22 '15 at 15:24
  • @AdrianLarson... You are right but this is the workaround i was able to achieve this. I would really appreciate if you can suggest some other workaround. :) – MIX DML Oct 22 '15 at 15:43
  • Well, this can all be accomplished server side. I would maintain a Set<String> for which Status values to whitelist. Besides which the answer linked in the comments demonstrates how to programatically determine which of them are Closed. There is no need to arbitrarily blacklist 'Escalated', for example. Someone could flip that to be Closed! – Adrian Larson Oct 22 '15 at 15:45
  • Basically there are two parts of this question. Which statuses are closed? Which correspond to a selected RecordType? I would recommend reading the linked question. – Adrian Larson Oct 22 '15 at 15:48
  • Adding the field to the standard page layout is fine and filters the closed values by RT. When adding the field to a VF, all values defined within the support process are displayed including all non closed values. The linked question may have merit but I'd need convince the users, however there must be a solution to this, it seems a very simple request! – Ian Oct 22 '15 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.