You need to sign in to do that
Don't have an account?
Scott.M
Visual Force Lookup Field
Hi,
This is a simple question, is there a visual force element for lookup fields. I'm looking at the Visual Force component reference but can't find one, maybe I'm blind. Anyone know if I'm looking for something that doesn't exist?
Thanks,
Scott
This is a simple question, is there a visual force element for lookup fields. I'm looking at the Visual Force component reference but can't find one, maybe I'm blind. Anyone know if I'm looking for something that doesn't exist?
Thanks,
Scott
Message Edited by TehNrd on 07-16-2008 10:41 AM
All Answers
In my situation I have a custom object (CA) that has a related list of an other custom object (CB). When a new CA is created i want to be able to add N of CB to CA in the create interface without having to save the object and add the CB objects from the related list.
Basically what I'm trying to do is have a list of lookup fields with an add button that adds a new field to the list. Very much like adding attachments to an email in Gmail. I'm wondering if there's a way of having a generic lookup field that's not tied to a specific field in the object being created.
Scott.M wrote:
I'm wondering if there's a way of having a generic lookup field that's not tied to a specific field in the object being created.
Yes. You will need to do this with either a custom controller or an extension. You can create an object in the controller with a lookup field to be a place holder for an Id.
Message Edited by TehNrd on 05-20-2008 01:18 PM
I'm trying to do the same thing with a lookup to a campaign on a Visual Force page. However, I can't seem to get the lookup field to appear. I have tried the two scenarios shown below:
Scenario 1
Code:
Extension:
// Create uninitialised member to store Id of Campaign selected by user
Campaign RelatedToCampaign;
Page:
<apex:inputField value="{!RelatedToCampaign.Id}" />
Screenshot shown below - CampaignId is read only (even though inputField apex tag is used)
Scenario 2
Code:
Extension:
// Create member to store Id of Campaign selected by user and set to arbitrary campaign
Campaign RelatedToCampaign =[select Id, Name from Campaign limit 1][0];
Page:
<apex:inputField value="{!RelatedToCampaign.Id}" />
Screenshot shown below - CampaignId is read only (even though inputField apex tag is used)
Anything I'm doing wrong?
Many thanks in advance
Sam
-Jason
Message Edited by TehNrd on 07-16-2008 10:16 AM
Regards
Sam
Message Edited by TehNrd on 07-16-2008 10:41 AM
Many thanks!
Sam
One thing to watch out for is that depending on the user field level security still applies to the Lookup field.