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
mDizz_7mDizz_7 

Saving related list inline editing Visualforce

Hello everyone,

 

I'm building a VF page where I have custom object related to an Opportunity. I've got everything built but can not get the edits to to save from the VF page to the actual record. Code is below, any help would be much appriciated. 

 

<apex:page standardController="Opportunity" sidebar="false" >
<apex:form >
<apex:sectionHeader title="{!Opportunity.name}"/>
<apex:pageBlock mode="inlineEdit" title="Equipment">
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!quicksave}"/>
<apex:commandButton value="Close" onClick="window.top.close();"/>
</apex:pageBlockButtons>
<apex:pageBlocktable value="{!Opportunity.Equipment__r}" var="equipment" >
<apex:column headerValue="Remove">
<apex:inputCheckbox value="{!equipment.Remove_Equipment__c}" />
</apex:column>
<apex:column headerValue="Reciever R#">
<apex:outputField value="{!equipment.Name}"/>
</apex:column>
<apex:column headerValue="Receiver S#">
<apex:outputField value="{!equipment.Receiver_S__c}"/>
</apex:column>
<apex:column headerValue="Receiver Model">
<apex:outputField value="{!equipment.Receiver_Model__c}"/>
</apex:column>
<apex:column headerValue="Programming">
<apex:outputField value="{!equipment.Programming__c}">
<apex:inlineEditSupport event="ondblclick"/>
</apex:outputField>
</apex:column>
<apex:column headerValue="Status">
<apex:outputText value="{!equipment.Statis__c}"/>
</apex:column>
</apex:pageBlocktable>
</apex:pageBlock>
<center>
<apex:commandButton action="{!quicksave}" value="Save"/>
<apex:commandButton onClick="window.top.close();" value="Close" />
</center>
</apex:form>
</apex:page>

bob_buzzardbob_buzzard

Is is the related objects that aren't saving?  That is expected behaviour.  The standard controller save only write back the changes to the object being managed - it doesn't traverse the object graph and write back all reachable objects.  You'll need to create an extension controller that writes back the related list and then invokes the standard object save.

mDizz_7mDizz_7

Thanks for the reply, can you point me to an example of the extension needed?

bob_buzzardbob_buzzard

This is pretty much the use case from one of my blog posts at:

 

http://bobbuzzard.blogspot.co.uk/2011/03/edit-parent-and-child-records-with.html

 

This is an account and its related contacts, so should be straightforward to adapt.

SAHG-SFDCSAHG-SFDC
How do we save  the data from the inline VF  page used on a standard page as related list?
Julija KlimecaJulija Klimeca
Hi , have you write the appropriate apex class for this task? Because right now I am dealing with the same issue.