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
stollmeyerastollmeyera 

Cross Object inputFields - Not Working

I have a VF page with the Opportunity as the standard controller.  Within this page I have referenced the related Account with some input fields.  You can see this below in a small snippet I took:

 

................<apex:inputField Value="{!Opportunity.Reason_Won__c}" required="true" />
                <apex:inputField Value="{!Opportunity.Sale_Notes__c}"  style="width:125pt; height:50pt"/>
            </apex:pageblocksection>
            
            <apex:pageblocksection showHeader="true" columns="2" title="2 - Account Info" rendered="{!if(Opportunity.Amount=0, false, true)}">
                <apex:inputField Value="{!Opportunity.LeadSource}"  required="true"/>
 	 <apex:inputField Value="{!Opportunity.Account.Industry}" required="true" /> .................

 

 

The whole idea here is to allow my users to perform an operation that requires them to populate fields under the Account and Opportunity.  Unfortunately, what happens when they save the page is it only updates the Opportunity fields while disregarding any changes made to the Account fields.  In otherworsd, I may have selected "Fitness" for the Account.Industry inputField.  However, upon saving the page the Industry field is left blank under the Account.  Is this by design?  If so, how would I manipulate it with APEX to allow me to pass these changes to the Account?

NzgonNzgon

Create your own logic for save button:

 

-update Opportunity

-query aaccount record (include Id) and update values baed on values from form fields .

-update account record..

 

Nash