Getting the LookUp filter to show up in VisualForce page as in the standard SalesForce page

Share on

When you are creating a new record, the LookUp filters work well in the standard SalesForce page but the same does not happen when creating a record in the VisualForce page. Let us look at this issue using an example –

  1. Create a new custom object say Equipment which has a lookup relation with Account.
  2. Create a new lookup custom field in Case which relates with Equipment.
  3. Case has already related with standard object account.
  4. Create lookup filter for Equipment filed in case such that: Case.AccountId equals Case. Equipment. AccountId.
  5. Go to any account record and create a new case for that Account.
  6. When user will select Equipment for that case only those Equipment records will be available for user to select which are related to the same Account for which Case is being created.
  7. Now create a VF page for create Case.
  8. As user will always be creating Case from an Account and user is not allowed to update the Account while on the case page thus, account field is incorporated with <apex:outField> Tag.
  9. Run this VF page where it can be seen that lookup filter for Equipment it not showing any result which was working in standard case create page.


  1. Replace <apex:outputField> tag with <apex:inputField> for the standard Account field on case.
  2. Disable Account field using JS/ CSS instead of rendering using <apex:outputField>.


Share on