You need to sign in to do that
Don't have an account?
sfdc dev 2317
Save button not working on pageBlockTable column
With regrads to my previous question (https://developer.salesforce.com/forums/ForumsMain?id=9062I000000QzvvQAC), I am trying to save records on one of the pageblockTable column Case Review Notes (Case_Comments_On_VFReport__c).
It does save in a variable and when I hit on save button, I can see value only on UI. But nothing gets updated in database. Even after quering in Devconsole I dont see any updates on this field.
Can you guys please help me out, where I am doing wrong and what should be included in code?
Here is VF page:
It does save in a variable and when I hit on save button, I can see value only on UI. But nothing gets updated in database. Even after quering in Devconsole I dont see any updates on this field.
Can you guys please help me out, where I am doing wrong and what should be included in code?
Here is VF page:
<apex:page controller="VF_CaseSearch" action="{!searchCase}" tabStyle="Case" sidebar="false"> <apex:form > <apex:pageBlock> <apex:pageblockSection > <apex:inputText value="{!cas.CaseNumber}" label="Search Case Number"/> </apex:pageblockSection> <!---Search Button--> <apex:pageblockButtons location="bottom"> <apex:commandButton value="Search" action="{!searchCase}"/> </apex:pageblockButtons> </apex:pageBlock> <apex:pageBlock title="Case Details" id="details" rendered="{! IF( caseList != null && caseList.size >0, true, false)}" mode="edit"> <apex:pageBlockTable value="{!caseList}" var="c"> <apex:column value="{!c.CaseNumber}" headerValue="Case Number"/> <apex:column value="{!c.CreatedDate}" headerValue="Created Date"/> <apex:column value="{!c.Status}" headerValue="Status"/> <apex:column value="{!c.Severity__c}" headerValue="Priority"/> <apex:column headerValue="Case Review Notes"> <apex:inputField value="{!c.Case_Comments_On_VFReport__c}" /> </apex:column> </apex:pageBlockTable> <apex:inlineEditSupport /> <!---Save Button --> <apex:pageBlockButtons html-align="left" location="top"> <apex:commandButton value="Save" action="{!save}" /> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>Custom Controller:
public with sharing class VF_CaseSearch { public Case cas{get;set;} public List<Case> caseList {get;set;} List<string> conditions = new List<string>(); public VF_CaseSearch(){ cas = new Case(); } public void searchCase(){ if(caseList !=null && caseList.size()>0){ caseList=null; } searchCases(); conditions.clear(); } public Void searchCases(){ if(caseList != null && !caseList.isEmpty()){ caseList.clear(); } //create a dynamic query for filter results String strQuery ='SELECT Id, CaseNumber, CreatedDate, Status, Severity__c, Case_Comments_On_VFReport__c, FROM Case'; if(cas.CaseNumber !=null && cas.CaseNumber !=''){ conditions.add('CaseNumber Like\'%' +cas.CaseNumber +'%\' '); } if (conditions.size() > 0) { strQuery += ' WHERE ' + conditions[0]; for (Integer i = 1; i < conditions.size(); i++) strQuery += ' AND ' + conditions[i]; } caseList = Database.query(strQuery); } // Save button public PageReference save(){ try{ Database.update(caseList); system.debug('caseList'+ caseList); return ApexPages.CurrentPage(); } catch(DMLException e){ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,e.getMessage())); } return null; } }
Best Answer chosen by sfdc dev 2317
sfdc dev 2317
Here is the solution (https://developer.salesforce.com/forums/ForumsMain?id=9062I000000QzvvQAC)