I have read blogs posted on dev community too but this is not getting resolved. I am creating a custom button to clone the cases.
<apex:page standardController="case" extensions="VFController">
<apex:form id="frmId">
<apex:pageBlock id="pb">
<apex:messages ></apex:messages>
<!--<apex:sectionHeader title="objcase Edit" subtitle="{!objcase.objcaseNumber}"/>
<apex:form >-->
<apex:pageBlockSection columns="1" title="Clones objcase" id="pbs_Clone">
<apex:inputField value="{!objcase.OwnerId}" required="false"/>
<apex:inputField value="{!objcase.AccountId}" required="true"/>
<apex:inputField value="{!objcase.caseNumber}" required="false"/>
<apex:inputField value="{!objcase.Status}" required="true"/>
<apex:inputField value="{!objcase.Customer_Status__c}" required="true"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}" rerender="theForm"/>
/>
<apex:commandButton value="Cancel" action="{!Cancel}" rerender="theForm"/>
/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
This is my controller:
public Class VFController
{
public Case objcase {get;set;}
public string caseID;
private Case objNewcase;
private string queryString = '';
public string strPrevCurrency {get;set;}
Map<String, Schema.SObjectField> mapcaseFields;
//constructor
public VFController(ApexPages.StandardController controller) {
caseID = ApexPages.currentPage().getParameters().get('id');
if(caseID != null)
{
mapcaseFields = Schema.SObjectType.case.fields.getMap() ;
objNewcase = [ select id,OwnerId,AccountId,caseNumber,Status,Customer_Status__c from case where id = :caseID ] ;
objcase = objNewcase.clone(false,true,false,false);
}
}
}
How should i fix this?
Thanks, Richa