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
RichardR1RichardR1 

save function does not work for cross object changes in visualforce page

Hello, I am new and teaching myself Visualforce development and I need help. I created a visualforce page to be placed on a child custom object record detail page.

All I want to do is allow my users to be able to edit some fields from the parent object (Contact) while they are on the child object (Job Applicant) record page. I was able to show the fields in the visualforce page, however, when I test it by make editing the field values and clicking Save, the changes do not save at all. I need to accomplish this in Classic interface.

<apex:page standardController="Job_Applicant__c" sidebar="false" >
   <apex:form >
   <apex:inlineEditSupport />
   <apex:pageBlock mode="maindetail" >
   <apex:pageBlockSection  >
           
         <apex:pageBlockSectionItem> <apex:outputField value="{!Job_Applicant__c.Contact_r.Handle_with_care__c}" /> </apex:pageBlockSectionItem>
         <apex:pageBlockSectionItem > <apex:outputField value="{!Job_Applicant__c.Contact_r.Geographic_Preferences_Notes__c}"/> </apex:pageBlockSectionItem>

   </apex:pageBlockSection>
 <apex:commandButton action="{!quicksave}" value="Save" />
   </apex:pageBlock>
   </apex:form>
</apex:page>
Best Answer chosen by RichardR1
RichardR1RichardR1
This has been solved by creating an appropriate test class which some developer helped me with.

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Richard,

>> https://salesforcediaries.com/2019/07/12/showing-editable-parent-record-details-on-child-record-lightning-page-without-code-in-salesforce-lightning-experience/

I would suggest trying the above implementation as this seems to be of a similar kind that you can try checking.

For Visualforce implementation, you can try checking: https://developer.salesforce.com/forums/?id=9060G000000Bin4QAC

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
 
RichardR1RichardR1
Thanks Anutej, however I need to implement in Classic UI.
RichardR1RichardR1
This has been solved by creating an appropriate test class which some developer helped me with.
This was selected as the best answer