• Alex Popoff
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello,

I am trying to give users a more convenient way to add records to a related list (which is derived from a custom object) from the Opportunity detail page via a Visualforce page (essentially inline adding).  I've been trying to modify the following code, which works if the visualforce page is on the custom object page layout.  The issue is once I try to make standardcontroller = Opportunity, which I need to do so the visualforce page shows up on the opportunity page layout, I start receiving errors.  Any ideas?

<apex:page standardController="Custom_Object__c">
<apex:form >
     <apex:pageBlock mode="edit" >
         <apex:pageblockSection title="Add Record" columns="2">
             <apex:inputField value="{!Custom_Object__c.Field1__c}"/>
             <apex:inputField value="{!Custom_Object__c.Field2__c}"/>
             <apex:commandButton action="{!save}" value="Submit"/>
         </apex:pageblockSection>
     </apex:pageBlock>
</apex:form>
</apex:page>

When I simply change the controller to Opportunity, I get the following error: Error: Unknown property 'OpportunityStandardController.Custom_Object__c' which ties to line 5.

I've tried adding in the path to the custom object by changing line 5 to:
             <apex:inputField value="{!Opportunity.Custom_Object__c.Field1__c}"/>
But I get the error Error: Invalid field Custom_Object__c for SObject Opportunity

I've tried replacing __c with __r to that same line since it's a related list, and then I get this error:
Error: Could not resolve the entity from <apex:inputField> value binding '{!Opportunity.Custom_Object__r.Field1__c}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.

Any help is appreciated!

Thanks,
Alex
Hello,

I am trying to give users a more convenient way to add records to a related list (which is derived from a custom object) from the Opportunity detail page via a Visualforce page (essentially inline adding).  I've been trying to modify the following code, which works if the visualforce page is on the custom object page layout.  The issue is once I try to make standardcontroller = Opportunity, which I need to do so the visualforce page shows up on the opportunity page layout, I start receiving errors.  Any ideas?

<apex:page standardController="Custom_Object__c">
<apex:form >
     <apex:pageBlock mode="edit" >
         <apex:pageblockSection title="Add Record" columns="2">
             <apex:inputField value="{!Custom_Object__c.Field1__c}"/>
             <apex:inputField value="{!Custom_Object__c.Field2__c}"/>
             <apex:commandButton action="{!save}" value="Submit"/>
         </apex:pageblockSection>
     </apex:pageBlock>
</apex:form>
</apex:page>

When I simply change the controller to Opportunity, I get the following error: Error: Unknown property 'OpportunityStandardController.Custom_Object__c' which ties to line 5.

I've tried adding in the path to the custom object by changing line 5 to:
             <apex:inputField value="{!Opportunity.Custom_Object__c.Field1__c}"/>
But I get the error Error: Invalid field Custom_Object__c for SObject Opportunity

I've tried replacing __c with __r to that same line since it's a related list, and then I get this error:
Error: Could not resolve the entity from <apex:inputField> value binding '{!Opportunity.Custom_Object__r.Field1__c}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.

Any help is appreciated!

Thanks,
Alex