You need to sign in to do that
Don't have an account?
DonJ
Return ID from custom object in Contact
I have a VF page with an input field to allow the user to input the value of a custom field on a contact record. I need to lookup the custom field to get the id on this record to then display the contact record. I am using the standard contact controller but can add an extension if I need to look up the custom field. Is there any sample code that anyone has that might give me a jump start on this? I am really looking for suggestions on the fastest method to get the lookup completed since this will be done hundreds if not thousands of times per day and speed is therefore very important.
Hi,
If your custom field points to another custom or standard object then just use apex:inputfield tag like:
For example, if you are doing a lookup to a contact then you get the 'lookup contact' link icon next to the textbox. Thats all there is to it. You'll also get the label associated to the item included as well.
Otherwise you'll have to build your own search or list control (e.g. a SelectList) and link it yourself.
If you are coming from the item to link to then pass it in in the url queryString and set this in your constructor.
Rich.
Hi Richie,
Thanks for your reply, I do appreciate it. I should have explained this is in a bit more depth. I want use a barcode scanner to collect a value for a custom field on the contact object (this is the input field per your example), use that value (without any user intervention) to lookup the contact that value is related to and display it's contact detail section to the VF page.
Don
If this is the case, then you will need to create a controller extension that gets a contact. Something like this:
This function will return a contact if one has been found or return null if a contact hasn't been found (or multiple contacts have been found).