0

I have a visual force page where the standard controller is the Case object and it has a related object. I need to save edits made to the related object, but there doesn't seem to be a straight forward way of doing so.

Code:

<apex:repeat value="{!Case.Vitality_Check_Attributes__r}" var="att">
      <table>
            <td class="text-right">
                <apex:outputLabel value="Name" for="name"/>
                <apex:inputField value="{!att.name}" id="name"/>
                <br></br>
                <apex:outputLabel value="Assesment Group ID" for="agi"/>
                <apex:inputField value="{!att.Assessment_Group_ID__c}" id="agi"/>
                <br></br>
                <apex:outputLabel value="Assesment Identifier" for="ai"/>
                <apex:inputField value="{!att.Assessment_Identifier__c}" id="ai"/>
                <br></br>
                <apex:outputLabel value="Assesment ID" for="aid"/>
                <apex:inputField value="{!att.Attribute_ID__c}" id="aid"/>
                <br></br>
                <apex:outputLabel value="Attribute Identifier" for="ati"/>
                <apex:inputField value="{!att.Attribute_Identifier__c}" id="ati"/>
                <br></br>
                <apex:outputLabel value="Attribute" for="atr"/>
                <apex:inputField value="{!att.Attribute_Value__c}" id="atr"/>
                <br></br>
                <apex:outputLabel value="Source Type" for="src"/>
                <apex:inputField value="{!att.Source_Type__c}" id="src"/>
                <br></br>
                <apex:commandButton action="{!att.Save}" value="Save"/>
            </td>
       </table>
</apex:repeat>

How would I make the att.save work?

1
  • Is this VF page associated to a Case controllerExtension class? If yes, then you want to upsert all of the rows in the table in one action, not have a save button on each row
    – cropredy
    Commented Jun 6, 2015 at 0:22

1 Answer 1

-1

Use an Apex controller extension class and refer it in the extensions attribute of the page tag. Create a method called save and then refer to the save method as {!save} in the action attribute of the visualforce tag. The save method contains the Apex code to save the Case and ita related record to the relevant objects.

You must log in to answer this question.

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