You need to sign in to do that
Don't have an account?
Displaying attribute of parent on child edit page
I am trying to display the attribute of the parent object (Proposal) on my child object (Line Item) edit page. However, I can't seem to figure out the proper syntax or way to make this call. I continue to get a message stating Unknown property 'Line_Items__cStandardController.Proposal__r'. Any thoughts on how I can fix the line higlighted below? Thanks!
<apex:page standardController="Line_Items__c" sidebar="true">
<apex:sectionHeader title="Edit Proposal Line Item" subtitle="{!Line_Items__c.name}"/>
<apex:form >
<apex:pageBlock title="Edit Proposal Line Item" id="thePageBlock" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:actionRegion >
<apex:pageBlockSection title="Basic Information" columns="1">
<apex:inputField value="{!Line_Items__c.Proposal__c}"/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Type"/>
<apex:outputPanel >
<apex:inputField value="{!Line_Items__c.Type__c}">
<apex:actionSupport event="onchange" rerender="thePageBlock" status="status"/>
</apex:inputField>
<apex:actionStatus startText="applying value..." id="status"/>
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:actionRegion>
<apex:pageBlockSection title="Platform Access and Initial Setup" columns="1"
rendered="{!Line_Items__c.Type__c == 'Platform Access and Initial Setup'}">
<apex:outputText value="Based on the launch model selected, input the corresponding cost listed below into the Actual Cost field."/>
<apex:outputText value="Shared Cost = $10,000"/>
<apex:outputText value="Dedicated Cost = $20,000"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Application AHMS" columns="1"
rendered="{!Line_Items__c.Type__c == 'Application AHMS'}">
<apex:outputField value="{!Line_Items__c.Proposal__c}"/>
<apex:inputField value="{!Line_Items__c.Application__c}"/>
<apex:outputField value="{!Line_Items__c[Proposal__r]['Calculated_Site_Equivalents__c']}"/>
<apex:inputField value="{!Line_Items__c.Actual_Site_Equivalents_Used__c}"/>
<apex:inputField value="{!Line_Items__c.Suggested_Price__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection columns="1">
<apex:inputfield value="{!Line_Items__c.Actual_Cost__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Seems like you just want {!Line_Items__c.Proposal__r.Calculated_Site_Equivalents__c} -- no reason for the dynamic reference syntax. And [Proposal__r] would certainly not be correct with dynamic syntax.
When I use this, it is pulling a zero instead of the actual saved value. Any thought on why this is?
Is this due to the fact that field on the Proposal object is of the type of formula? if so, is there a way to resolve this issue?
Is this a record that has not been saved yet? I would expect formulas to be updated only when the record is saved.