You need to sign in to do that
Don't have an account?
sfdc@isha.ax1814
standard save - on case status change display new fields and save
Hi team,
I have a vfpage design which holds the logic of based on the case status change new fields should be displayed and once value will be given and click on save values will be saved and fields should be non edit mode and should hike the save button as well
vfpage:
<apex:page standardController="Case" extensions="caseextension">
<apex:form id="theForm">
<apex:pageBlock mode="inlineEdit">
<apex:pageblockSection >
<apex:outputField value="{!Case.Status}">
<apex:actionSupport event="onchange" reRender="theForm"/>
</apex:outputField>
</apex:pageblockSection>
</apex:pageBlock>
<apex:pageblock mode="inlineEdit">
<apex:pageblockSection rendered="{!IF(Case.Status = 'Working' && rend,TRUE,FALSE)}">
<apex:inputField value="{!Case.Working_1__c}"/>
<apex:inputField value="{!Case.Working_2__c}"/>
</apex:pageblockSection>
<apex:pageblockSection rendered="{!Case.Status = 'Escalated' && rend}">
<apex:inputField value="{!Case.NewText1__c}"/>
<apex:inputField value="{!Case.New_Text2__c}"/>
</apex:pageblockSection>
<apex:pageblockSection rendered="{!Case.Status = 'Working' && rend1}">
<apex:outputField value="{!Case.Working_1__c}"/>
<apex:outputField value="{!Case.Working_2__c}"/>
</apex:pageblockSection>
<apex:pageblockbuttons>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageblockbuttons>
</apex:pageblock>
</apex:form>
</apex:page>
Class:
public class caseextension {
private final Case caseObj;
public boolean rend{get;set;}
public boolean rend1{get;set;}
// get Case record from the standard controller and putting it in a member variable
public caseextension (ApexPages.StandardController stdController) {
this.caseObj = (Case)stdController.getRecord();
rend=true;
rend1=false;
}
public PageReference save(){
// TO DO
rend=false;
rend1=true;
insert caseObj;
return null;
}
}
Iam getting below error
Regards,
Isha
I have a vfpage design which holds the logic of based on the case status change new fields should be displayed and once value will be given and click on save values will be saved and fields should be non edit mode and should hike the save button as well
vfpage:
<apex:page standardController="Case" extensions="caseextension">
<apex:form id="theForm">
<apex:pageBlock mode="inlineEdit">
<apex:pageblockSection >
<apex:outputField value="{!Case.Status}">
<apex:actionSupport event="onchange" reRender="theForm"/>
</apex:outputField>
</apex:pageblockSection>
</apex:pageBlock>
<apex:pageblock mode="inlineEdit">
<apex:pageblockSection rendered="{!IF(Case.Status = 'Working' && rend,TRUE,FALSE)}">
<apex:inputField value="{!Case.Working_1__c}"/>
<apex:inputField value="{!Case.Working_2__c}"/>
</apex:pageblockSection>
<apex:pageblockSection rendered="{!Case.Status = 'Escalated' && rend}">
<apex:inputField value="{!Case.NewText1__c}"/>
<apex:inputField value="{!Case.New_Text2__c}"/>
</apex:pageblockSection>
<apex:pageblockSection rendered="{!Case.Status = 'Working' && rend1}">
<apex:outputField value="{!Case.Working_1__c}"/>
<apex:outputField value="{!Case.Working_2__c}"/>
</apex:pageblockSection>
<apex:pageblockbuttons>
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageblockbuttons>
</apex:pageblock>
</apex:form>
</apex:page>
Class:
public class caseextension {
private final Case caseObj;
public boolean rend{get;set;}
public boolean rend1{get;set;}
// get Case record from the standard controller and putting it in a member variable
public caseextension (ApexPages.StandardController stdController) {
this.caseObj = (Case)stdController.getRecord();
rend=true;
rend1=false;
}
public PageReference save(){
// TO DO
rend=false;
rend1=true;
insert caseObj;
return null;
}
}
Iam getting below error
Regards,
Isha
You need to upsert dml operation if you are using same form for insert and update both.
After saving fields should be in non edit mode. but in my req after saving fields are in still editable and textbox is appearing.
Can somene help me on this vfpage code.
Regards,
Isha
To Do this
1) Create a boolean variable isSuccessfullySaved (default set value to false).
2)Use the variable like this as a below example.
Thabk you somuch for yur reply. Iam new to this so asking help for small changes as well.
I have modified my vf page like below.
this is a inline vfpage on case . when ever page loads still fields are in edit mode[inpiut field ] find below screenshot for reference.
<apex:page standardController="Case" extensions="caseextension">
<apex:form id="theForm">
<apex:pageBlock mode="inlineEdit">
<apex:pageblockSection >
<apex:inputField value="{!Case.Status}">
<apex:actionSupport event="onchange" reRender="theForm"/>
</apex:inputField>
</apex:pageblockSection>
</apex:pageBlock>
<apex:pageblock>
<apex:pageblockSection rendered="{!Case.Status = 'Working' && not(isSuccessFullySaved)}">
<apex:inputField value="{!Case.Working_1__c}"/>
<apex:inputField value="{!Case.Working_2__c}"/>
</apex:pageblockSection>
<apex:pageblockSection rendered="{!Case.Status = 'Escalated' && not(isSuccessFullySaved)}">
<apex:inputField value="{!Case.NewText1__c}"/>
<apex:inputField value="{!Case.New_Text2__c}"/>
</apex:pageblockSection>
<apex:pageblockSection rendered="{!Case.Status = 'Escalated' && isSuccessFullySaved}">
<apex:outputField value="{!Case.NewText1__c}"/>
<apex:outputField value="{!Case.New_Text2__c}"/>
</apex:pageblockSection>
<apex:pageblockSection rendered="{!Case.Status = 'Working' && isSuccessFullySaved}">
<apex:outputField value="{!Case.Working_1__c}"/>
<apex:outputField value="{!Case.Working_2__c}"/>
</apex:pageblockSection>
<apex:pageblockbuttons >
<apex:commandButton value="Save" action="{!save}" rerender="theForm" rendered="{!not(isSuccessfullySaved)}"/>
</apex:pageblockbuttons>
</apex:pageblock>
</apex:form>
</apex:page>
Regards,
Isha