function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
iswarya sekar 7iswarya sekar 7 

when clicking closecase custom button it should display as this case is already closed in vf page. anyone help me.thanks in advance!!

<apex:page standardController="Case" showHeader="false" >
        <apex:pageblock title="Case Details">
            <apex:pageblocksection columns="1">
                <apex:inputField value="{!Case.CaseNumber}"/>
                <apex:outputfield value="{!Case.Status}"/>
                <apex:outputfield value="{!Case.Reason}"/>
            <apex:pageblockbuttons >
                <apex:commandButton value="ClosetheCase" action="{!Save}"/>

Hitesh Khatri 13Hitesh Khatri 13
Hi iswarya sekar 7 !
You can create a custom controller or contro ller extension and write a method for cheking the status of the case then you can call that method through action attribute of command button.  
//Visual force Page
 <apex:commandButton value="ClosetheCase" action="{!methodName}"/>

// In custom controller /controller extension

public PageReference methodName() {
 //Check for the case status 
//If already closed show Apex page message. return;


Hitesh Khatri

Salesforce Developer