I want a "Reopened" status for particular record types in my org. However, I don't want users to be able to set the status directly - this status can only be set through a particular visualforce page.

If a case is re-opened, users would see the status as reopened but they would only be able to select normal values for status through the picklist.

How is this possible with Salesforce?

1 Answer 1


You just need some simple Apex Code.

Shared Code

public class CaseControl {
  public static Boolean allowReopen = false;

  public static void verifyReopen(Case[] prior, Case[] current) {
    if(!allowReopen) {
      for(Integer index = 0, size = current.size(); index < size; index++) {
        if(prior[index].Status == 'Closed' && 
           current[index].Status <> 'Closed') {
          current[index].addError('Please use the Visualforce page to reopen this case.');


trigger verifyReopen on Case (after update) {
  CaseControl.verifyReopen(Trigger.old, Trigger.new);

Then, when you want to allow a reopen, say, in your Visualforce code...

Case Reopen

public PageReference reopenAndSave() {
  CaseControl.allowReopen = true;
  caseRecord.Status = 'Reopened';
  update caseRecord;
  return new ApexPages.StandardController(caseRecord).view();
  • did you mean caseRecord.Status = 'Reopened' ?
    – cropredy
    Commented Apr 30, 2016 at 6:00
  • @cropredy Yeah, I thought I changed it. Silly me.
    – sfdcfox
    Commented Apr 30, 2016 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .