enter image description here

Im planning to update each row using actionSupport event = "onchange". I'm trying to get the ID of the row but it is NULL.

Or Is there any way It can be updated as a list without using the recordsetVar.

Here is my visualforce page:

    <apex:form >
        <apex:pageBlock >            
                <apex:pageBlockSection >                
                    <apex:pageBlockTable value="{!ORRQualQuestions}" var="ques" html-cid="usersAppTable"> 
                        <apex:column value="{!ques.Sequence__c}" headerValue="Sequence" headerClass="TableTitle"/>
                        <apex:column value="{!ques.Department__c}" headerValue="Department" headerClass="TableTitle"/>
                        <apex:column value="{!ques.Type__c}" headerValue="Type" headerClass="TableTitle"/>
                        <apex:column value="{!ques.Questionnaires__c}" headerValue="Questionnaires" headerClass="TableTitle"/> 
                        <apex:column >
                            <apex:param name="id" value="{!ques.Id}" assignTo="{!tobeEdited}"></apex:param>
                            <apex:outputText value="{!ques.Id}"></apex:outputText>
                        <apex:column headerValue="Status">
                            <apex:inputField value="{!ques.Status__c}"></apex:inputField>
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>



Apex Class:

public class ORRQual {

    private final List<ORRQual__c> questions;

    public ORRQual__c items {get;set;}
    public ORRQual__c tobeEdited{get;set;}

    public ORRQual(ApexPages.StandardController controller){  
      this.items = (ORRQual__c)controller.getRecord();
      questions = [SELECT Department__c,Id,Questionnaires__c,Sequence__c,Status__c,Type__c FROM ORRQual__c where Type__c = 'Country' order by Sequence__c ];


    public List<ORRQual__c> getORRQualQuestions(){
        return questions;

    public PageReference save(){
        PageReference pr = new PageReference('/apex/ORRQual');
                update answeredQuestions;               

        }catch(Exception e){

       return pr;

Kindly help me regarding on my issues. Thanks a lot Salesforce community.

1 Answer 1


If you just do a post-back, the status should be updated so you can call update on the whole list to update the status, but if you want to limit it to the record that was actually updated, you need to change your markup a bit (I've taken out the other columns for clarity):

<apex:pageBlockTable value="{!ORRQualQuestions}" var="ques" html-cid="usersAppTable"> 
    <apex:column headerValue="Status">
        <apex:inputField value="{!ques.Status__c}">
            <apex:actionSupport event="onchange" action="{!updateQuestion}">
                <apex:param name="toBeEdited" value="{!ques.ID}" assignTo="{!toBeEdited}" />

public ID toBeEdited {get;set;}

public void updateQuestion()
    for(ORRQual__c qual : ORRQualQuestions)
        if (qual.ID == toBeEdited)
            update qual;
  • DML in for loop is not a good practice Aug 13, 2017 at 15:41
  • @SantanuBoral It's only possible for it to execute once. Aug 13, 2017 at 23:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .