function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
David81David81 

Lookup field behavior when multiple matches exist

Hello all,

 

I'm currently working on developing a photo uploader to show photos on the Contact or Lead page. I know there are a couple implementation on the AppExchange, but neither one does all that I want, so I'm rolling my own.

 

Ideally, the page used to do the uploading will be as versatile as possible. (e.g. It could be launched from a Lead or Contact page or be launched by itself and allow the user to lookup the Lead or Contact to associate the photo with).

 

To accomplish this I'm using a "proxy" Task in my controller to get my hands on that handy "Lead/Contact" lookup field. What I'm having a hard time figuring out is how to get the full standard behaviour out of it. Most situations work great.

 

  • Select Lead or Contact and click the lookup icon to search for and select the proper record - Works
  • Select Lead or Contact, type in part or all of the name, click on the lookup icon to get results and select proper record - Works
  • Select Lead or Contact, type in part or all of the name and execute save method in controller which uses the WhoId from the proxy as the parentID of the attachment. Work when there is only one match in the database but breaks when there are multiple matches.

Is there a simple way to get the page to give me the nice dropdown to select the proper record before continuing? I'm not actually commiting this proxy Task to the database.

 

Thanks in advance.

 

David