You need to sign in to do that
Don't have an account?
Robert Davis 1
Visualforce - Reference a Lookup Field on a Custom Object to the Contact Object
I am attempting to create a Visualforce page that allows the user to select a contact from a lookup field on a custom object to the contacts object. I am surely missing something silly. Your help would be super.
The page would allow for the individual to enter the Contact Plan Name and then Select a Contact from the Contact Object. I have created a custom object called Contact_Plan__c.
Your help is greatly appreciated in advance.
Robert
<apex:page standardController="Contact_Plan__c"> <apex:pageBlock > <apex:pageBlockSection> <apex:form> <apex:inputField value="{! Contact_Plan__c.name}"/> <apex:inputField value="{! Contact_Plan__r.Contact.Name}"/> </apex:form> </apex:pageBlockSection> </apex:page>
The page would allow for the individual to enter the Contact Plan Name and then Select a Contact from the Contact Object. I have created a custom object called Contact_Plan__c.
Your help is greatly appreciated in advance.
Robert
You do not need the relationship here, try this
<apex:inputField value="{! Contact_Plan__c.Contact__c}"/>
assuming Contact__c is the API name of your Contact lookup field
All Answers
I was overthinking it. I just reference the field and Salesforce does the rest.
You do not need the relationship here, try this
<apex:inputField value="{! Contact_Plan__c.Contact__c}"/>
assuming Contact__c is the API name of your Contact lookup field
Use component <c:AdvancedLookup> a custom visualforce component
Github: https://github.com/dieffrei/visualforce-custom-lookup
Demo: https://dieffrei-com-developer-edition.na35.force.com/|
I hope you enjoy