function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dboonepesdboonepes 

Editing multiple related records in VF page

I would like to be able to edit specific fields in the Assets records related to an Account. Below you will find the visualforce page I wrote to do this. When I click the save button, it doesn't actually save the values I have put in the input Fields. What am I doing wrong here?

 

<apex:page standardController="Account">
    <apex:Form >
        <apex:pageBlock title="Check in Stations for {!Account.Nickname__c}">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!account.assets}" var="item">
                <apex:column value="{!item.Name}"/>
                <apex:column headerValue="Serial Number">
                    <apex:inputField value="{!item.SerialNumber}"/>
                </apex:column>
                <apex:column headerValue="Ethernet MAC Address">
                    <apex:inputField value="{!item.Ethernet_MAC_Address__c}"/>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:Form>
</apex:page>

 

Best Answer chosen by Admin (Salesforce Developers) 
Andy BoettcherAndy Boettcher

The standard "save" method only connects up with the Account record.  To save the Assets - you're going to have to create an Apex Controller on the backend with a custom save method.

 

-Andy

All Answers

Andy BoettcherAndy Boettcher

The standard "save" method only connects up with the Account record.  To save the Assets - you're going to have to create an Apex Controller on the backend with a custom save method.

 

-Andy

This was selected as the best answer
dboonepesdboonepes

I figured this was going to be the case, but I wanted an answer from a more experienced user before I went through the trouble of writing the controller. Thankfully it is an easy controller to write. I appreciate the help.

behappybehappy

Hello,

I have the same problem. Could you give me a copy of the controller (and testclass) you wrote to solve the problem ?

I'm brand new in classes, methods... and it would help me.

Many thanks in advance for your help.

Jean

 

jpbenjpben

dboonepes,

 

Can you share the controller for this VF page.  I have a similar use case that i want to solve.  I'm an Apex newbie and need some guidance.  

 

Thanks in advance,

John