You need to sign in to do that
Don't have an account?
Eric Blaxton 11
Visual Force Page Save button does not work in Lightning
Hi and appreciate any insight on this.
My save button no longer works. It was a VS button. I made a new List View button calling VFP/ APEX Not sure what went wrong here.
Button
VFP.
<apex:page standardController="Case" recordSetVar="cases" lightningStylesheets="true" extensions="setQuickCaseExtensionController">
<apex:form >
<apex:pageBlock title="Quick Case Entry" mode="edit">
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:pageBlockSection title="Case Details" columns="1">
<apex:inputField label="Source Type" required="true" value="{!case.Source_Type__c}" />
<apex:inputField label="Origin" required="true" value="{!case.Origin}"/>
<apex:inputField label="Contact" value="{!case.ContactId}"/>
<apex:inputField label="Subject" required="true" value="{!case.Subject}"/>
<apex:inputTextArea style="width:300px;height:100px" required="true" label="Description (Min 10 chars)" value="{!case.Description}"/>
<apex:inputField label="Category" required="true" value="{!case.Category__c}"/>
<apex:inputField label="Sub-Catagory 1" required="true" value="{!case.Sub_Catagory_1__c}"/>
<apex:inputField label="Sub-Catagory 2" required="true" value="{!case.Sub_Category_2__c}"/>
<apex:inputField label="Sub-Catagory 3" required="true" value="{!case.Sub_Category_3__c}"/>
<apex:inputField value="{!case.Related_Account__c}" label="Account"/>
<apex:inputField value="{!case.Incident_Occurence_Date__c}" label="Incident Occurrence Date"/>
<apex:inputField value="{!case.Incident_Occurrence_Time__c}" label="Incident Occurrence Time"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Save & Close Quick Case" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
APEX Class
public class setQuickCaseExtensionController {
private Case QC;
public ApexPages.StandardSetController stdController;
public setQuickCaseExtensionController(ApexPages.StandardSetController controller){
controller.setPageSize(10);
this.QC = (Case)controller.getRecord();
RecordType RecId = new RecordType();
RecId=[SELECT Id FROM RecordType where Name='Customer First' LIMIT 1];
QC.RecordTypeId=RecId.Id;
QC.Quick_Case__c = True;
QC.Origin = 'Phone';
QC.Source_Type__c = 'Consumer';
QC.Description='Quick Case';
QC.Quick_Case_Closed__c = True;
QC.Subject='New Quick Case';
stdcontroller=controller;
}
}
My save button no longer works. It was a VS button. I made a new List View button calling VFP/ APEX Not sure what went wrong here.
Button
VFP.
<apex:page standardController="Case" recordSetVar="cases" lightningStylesheets="true" extensions="setQuickCaseExtensionController">
<apex:form >
<apex:pageBlock title="Quick Case Entry" mode="edit">
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:pageBlockSection title="Case Details" columns="1">
<apex:inputField label="Source Type" required="true" value="{!case.Source_Type__c}" />
<apex:inputField label="Origin" required="true" value="{!case.Origin}"/>
<apex:inputField label="Contact" value="{!case.ContactId}"/>
<apex:inputField label="Subject" required="true" value="{!case.Subject}"/>
<apex:inputTextArea style="width:300px;height:100px" required="true" label="Description (Min 10 chars)" value="{!case.Description}"/>
<apex:inputField label="Category" required="true" value="{!case.Category__c}"/>
<apex:inputField label="Sub-Catagory 1" required="true" value="{!case.Sub_Catagory_1__c}"/>
<apex:inputField label="Sub-Catagory 2" required="true" value="{!case.Sub_Category_2__c}"/>
<apex:inputField label="Sub-Catagory 3" required="true" value="{!case.Sub_Category_3__c}"/>
<apex:inputField value="{!case.Related_Account__c}" label="Account"/>
<apex:inputField value="{!case.Incident_Occurence_Date__c}" label="Incident Occurrence Date"/>
<apex:inputField value="{!case.Incident_Occurrence_Time__c}" label="Incident Occurrence Time"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Save & Close Quick Case" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
APEX Class
public class setQuickCaseExtensionController {
private Case QC;
public ApexPages.StandardSetController stdController;
public setQuickCaseExtensionController(ApexPages.StandardSetController controller){
controller.setPageSize(10);
this.QC = (Case)controller.getRecord();
RecordType RecId = new RecordType();
RecId=[SELECT Id FROM RecordType where Name='Customer First' LIMIT 1];
QC.RecordTypeId=RecId.Id;
QC.Quick_Case__c = True;
QC.Origin = 'Phone';
QC.Source_Type__c = 'Consumer';
QC.Description='Quick Case';
QC.Quick_Case_Closed__c = True;
QC.Subject='New Quick Case';
stdcontroller=controller;
}
}
and use this below line and have a list button with content as URL
<apex:page standardController="Case" lightningStylesheets="true" extensions="setQuickCaseExtensionController">
Let us know if problem persists.
All Answers
Add /apex/CustFirstQuickCase this in the source
and do the below changes in your code.
Save button will work fine.
Hope this helps!
Thanks for your time on this.
Your suggestion works and the Save works as planned. Focus is set on the case as planned.
The issue is I need the call to the Apex class to determine the Record Type etc. When I add the call to the Apex class, the save does not work.
I am working on converting a VS button to a lightning button. This code seems like it should work without issue.
Regards,
Eric
<apex:page standardController="Case" lightningStylesheets="true" extensions="setQuickCaseExtensionController">
This should work fine. The save button will work as expected.
Hope this helps!
<apex:page standardController="Case" recordSetVar="cases" lightningStylesheets="true" extensions="setQuickCaseExtensionController" >
and use this below line and have a list button with content as URL
<apex:page standardController="Case" lightningStylesheets="true" extensions="setQuickCaseExtensionController">
Let us know if problem persists.
there is some typo error
Replace this line
with
and
this with
I already fixed those typo's. Thank you for following up.
Those suggestions worked. Very good and thanks for your help.
Eric