Filtered lookup

From Resco's Wiki
Jump to: navigation, search

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.

  1. Enable the Primary Contact field on the Account entity. See managing fields for instructions.
  2. 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.
  3. Click Edit Filter to open the Filter editor.
    1. Click Add Condition.
    2. Select Customer as field.
    3. Select Equals as operator.
    4. Click Variable and select the Account entity and the Id field.
    5. Click OK, then click Save & Close to close the filter editor.
  4. Open the Account’s form and add the Primary Contact field to the form. See adding fields for instructions.
  5. 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.