A filtered lookup is a view that is available from the form of another entity and displays related records. Let’s say that you want to add a primary contact field on the Account form and want to be able to choose from the contacts that belong only to the specific Account, instead of from all contacts.
- Enable the Primary Contact field on the Account entity. See managing fields for instructions.
- Create a new view of the type Lookup List for the Contact entity. See creating a view for instructions.
Let’s name it “Account’s Contacts”. You can also check the Hidden option, so that it is not shown in the view selector in the Mobile CRM application. Add any desired fields to the Primary and Secondary fields.
- Click Edit Filter to open the Filter editor.
- Click Add Condition.
- Select Customer as field.
- Select Equals as operator.
- Click Variable and select the Account entity and the Id field.
- Click OK, then click Save & Close to close the filter editor.
- Open the Account’s form and add the Primary Contact field to the form. See adding fields for instructions.
- Select the new field and click Properties. On the Lookup Views pane, enable the new lookup view and make it the default view.
After you save the form, publish the project and attempt to choose the Primary Contact for an Account, you can only choose from the filtered selection displaying the Account’s contacts, not all contacts. You still have the possibility to change the Lookup view to the default one with all contacts, unless you disable the Default View on the Primary Contact properties.