I have a lookup filter criteria on contact object on Account lookup field. Where among the conditions one condition is

Account Name: Sold To equals to True where sold to is a check box on account object. This filter criteria is working fine on standard contact page layout. But when i refer this field on VF pages the criteria is not working properly

 <apex:inputField styleclass="inputtxtboxstyle" value="{!con.AccountId}" id="compName" rendered="{!accEdit}">

enter image description here

when i click on lookup icon it is giving proper results. But if i enter some value and search in the input box it is giving a drop down with results which are having records that are not matching with search criteria

enter image description here

This dropdown actually results in the records which does not match with the crriteria.

Is there any way to make the results same for both lookup popup and on dropdown.

1 Answer 1


I suspect you will be facing the same behaviour in standard contact page layout as well.

The reason behind is, when you type account name and click save(without clicking lookup icon), Salesforce attempts to save the record and since it have two or more accounts with same name it gives the above mentioned error. In this scenario, the lookup filter is not at all considered.

Another scenario is, you type account name which have a single account by that name and click save, Salesforce attempts to save the record and found that it violates the lookup filter criteria and throws standard error message(or customized by admin) if the lookup filter criteria is required. In this scenario also, the lookup filter is considered only at saving the record not at the time of typing account name.

So you should train your users to type the account name and click lookup icon to get effective usage of lookup filters.

  • thank you.. yes i have observed the same even on standard layouts for sysadmin search is giving unmatched results.But for a profile type it is giving only matched records even on drop-down.So i am feeling here might be a chance with profile.. I am debugging it thoroughly will let you know exactly after goig through all cases given by u
    – Rajasekhar
    Oct 17, 2015 at 9:24
  • hi bigneshwaran i have observed for a custom profile even on standard page layout clicking save is populating a dropdown of filter matching criteria records only, but this is not happening on vf page
    – Rajasekhar
    Oct 17, 2015 at 9:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .